feat: 优化领导者服务

This commit is contained in:
tbphp
2025-07-08 21:10:06 +08:00
parent 7340cdded1
commit fe3fd9c14a
4 changed files with 90 additions and 34 deletions

View File

@@ -117,3 +117,8 @@ func (s *RedisStore) Pipeline() Pipeliner {
pipe: s.client.Pipeline(),
}
}
// Eval executes a Lua script on Redis.
func (s *RedisStore) Eval(script string, keys []string, args ...interface{}) (interface{}, error) {
return s.client.Eval(context.Background(), script, keys, args...).Result()
}

View File

@@ -56,3 +56,8 @@ type Pipeliner interface {
type RedisPipeliner interface {
Pipeline() Pipeliner
}
// LuaScripter is an optional interface that a Store can implement to provide Lua script execution.
type LuaScripter interface {
Eval(script string, keys []string, args ...interface{}) (interface{}, error)
}