|
|
@ -17,7 +17,7 @@ type (
|
|
|
|
// Store interface represents a KV store.
|
|
|
|
// Store interface represents a KV store.
|
|
|
|
Store interface {
|
|
|
|
Store interface {
|
|
|
|
Del(keys ...string) (int, error)
|
|
|
|
Del(keys ...string) (int, error)
|
|
|
|
Eval(script string, key string, args ...interface{}) (interface{}, error)
|
|
|
|
Eval(script, key string, args ...interface{}) (interface{}, error)
|
|
|
|
Exists(key string) (bool, error)
|
|
|
|
Exists(key string) (bool, error)
|
|
|
|
Expire(key string, seconds int) error
|
|
|
|
Expire(key string, seconds int) error
|
|
|
|
Expireat(key string, expireTime int64) error
|
|
|
|
Expireat(key string, expireTime int64) error
|
|
|
@ -39,7 +39,7 @@ type (
|
|
|
|
Llen(key string) (int, error)
|
|
|
|
Llen(key string) (int, error)
|
|
|
|
Lpop(key string) (string, error)
|
|
|
|
Lpop(key string) (string, error)
|
|
|
|
Lpush(key string, values ...interface{}) (int, error)
|
|
|
|
Lpush(key string, values ...interface{}) (int, error)
|
|
|
|
Lrange(key string, start int, stop int) ([]string, error)
|
|
|
|
Lrange(key string, start, stop int) ([]string, error)
|
|
|
|
Lrem(key string, count int, value string) (int, error)
|
|
|
|
Lrem(key string, count int, value string) (int, error)
|
|
|
|
Persist(key string) (bool, error)
|
|
|
|
Persist(key string) (bool, error)
|
|
|
|
Pfadd(key string, values ...interface{}) (bool, error)
|
|
|
|
Pfadd(key string, values ...interface{}) (bool, error)
|
|
|
@ -47,7 +47,7 @@ type (
|
|
|
|
Rpush(key string, values ...interface{}) (int, error)
|
|
|
|
Rpush(key string, values ...interface{}) (int, error)
|
|
|
|
Sadd(key string, values ...interface{}) (int, error)
|
|
|
|
Sadd(key string, values ...interface{}) (int, error)
|
|
|
|
Scard(key string) (int64, error)
|
|
|
|
Scard(key string) (int64, error)
|
|
|
|
Set(key string, value string) error
|
|
|
|
Set(key, value string) error
|
|
|
|
Setex(key, value string, seconds int) error
|
|
|
|
Setex(key, value string, seconds int) error
|
|
|
|
Setnx(key, value string) (bool, error)
|
|
|
|
Setnx(key, value string) (bool, error)
|
|
|
|
SetnxEx(key, value string, seconds int) (bool, error)
|
|
|
|
SetnxEx(key, value string, seconds int) (bool, error)
|
|
|
@ -74,7 +74,7 @@ type (
|
|
|
|
Zrevrange(key string, start, stop int64) ([]string, error)
|
|
|
|
Zrevrange(key string, start, stop int64) ([]string, error)
|
|
|
|
ZrevrangebyscoreWithScores(key string, start, stop int64) ([]redis.Pair, error)
|
|
|
|
ZrevrangebyscoreWithScores(key string, start, stop int64) ([]redis.Pair, error)
|
|
|
|
ZrevrangebyscoreWithScoresAndLimit(key string, start, stop int64, page, size int) ([]redis.Pair, error)
|
|
|
|
ZrevrangebyscoreWithScoresAndLimit(key string, start, stop int64, page, size int) ([]redis.Pair, error)
|
|
|
|
Zscore(key string, value string) (int64, error)
|
|
|
|
Zscore(key, value string) (int64, error)
|
|
|
|
Zrevrank(key, field string) (int64, error)
|
|
|
|
Zrevrank(key, field string) (int64, error)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -123,7 +123,7 @@ func (cs clusterStore) Del(keys ...string) (int, error) {
|
|
|
|
return val, be.Err()
|
|
|
|
return val, be.Err()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (cs clusterStore) Eval(script string, key string, args ...interface{}) (interface{}, error) {
|
|
|
|
func (cs clusterStore) Eval(script, key string, args ...interface{}) (interface{}, error) {
|
|
|
|
node, err := cs.getRedis(key)
|
|
|
|
node, err := cs.getRedis(key)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
@ -321,7 +321,7 @@ func (cs clusterStore) Lpush(key string, values ...interface{}) (int, error) {
|
|
|
|
return node.Lpush(key, values...)
|
|
|
|
return node.Lpush(key, values...)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (cs clusterStore) Lrange(key string, start int, stop int) ([]string, error) {
|
|
|
|
func (cs clusterStore) Lrange(key string, start, stop int) ([]string, error) {
|
|
|
|
node, err := cs.getRedis(key)
|
|
|
|
node, err := cs.getRedis(key)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
@ -393,7 +393,7 @@ func (cs clusterStore) Scard(key string) (int64, error) {
|
|
|
|
return node.Scard(key)
|
|
|
|
return node.Scard(key)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (cs clusterStore) Set(key string, value string) error {
|
|
|
|
func (cs clusterStore) Set(key, value string) error {
|
|
|
|
node, err := cs.getRedis(key)
|
|
|
|
node, err := cs.getRedis(key)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
@ -648,7 +648,7 @@ func (cs clusterStore) Zrevrank(key, field string) (int64, error) {
|
|
|
|
return node.Zrevrank(key, field)
|
|
|
|
return node.Zrevrank(key, field)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (cs clusterStore) Zscore(key string, value string) (int64, error) {
|
|
|
|
func (cs clusterStore) Zscore(key, value string) (int64, error) {
|
|
|
|
node, err := cs.getRedis(key)
|
|
|
|
node, err := cs.getRedis(key)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return 0, err
|
|
|
|
return 0, err
|
|
|
|