Documentation ¶
Index ¶
- Constants
- Variables
- type BlockedSettable
- type Client
- func (r *Client) Append(key, value string) *redis.IntCmd
- func (r *Client) BLPop(timeout time.Duration, keys ...string) *redis.StringSliceCmd
- func (r *Client) BRPop(timeout time.Duration, keys ...string) *redis.StringSliceCmd
- func (r *Client) BRPopLPush(source, destination string, timeout time.Duration) *redis.StringCmd
- func (r *Client) Decr(key string) *redis.IntCmd
- func (r *Client) DecrBy(key string, value int64) *redis.IntCmd
- func (r *Client) Del(keys ...string) *redis.IntCmd
- func (r *Client) Dump(key string) *redis.StringCmd
- func (r *Client) Exists(key ...string) *redis.IntCmd
- func (r *Client) Expire(key string, expiration time.Duration) *redis.BoolCmd
- func (r *Client) ExpireAt(key string, tm time.Time) *redis.BoolCmd
- func (r *Client) Get(key string) *redis.StringCmd
- func (r *Client) GetBit(key string, offset int64) *redis.IntCmd
- func (r *Client) GetClient() Commander
- func (r *Client) GetRange(key string, start, end int64) *redis.StringCmd
- func (r *Client) GetSet(key string, value interface{}) *redis.StringCmd
- func (r *Client) HDel(key string, fields ...string) *redis.IntCmd
- func (r *Client) HExists(key, field string) *redis.BoolCmd
- func (r *Client) HGet(key, field string) *redis.StringCmd
- func (r *Client) HGetAll(key string) *redis.StringStringMapCmd
- func (r *Client) HIncrBy(key, field string, incr int64) *redis.IntCmd
- func (r *Client) HIncrByFloat(key, field string, incr float64) *redis.FloatCmd
- func (r *Client) HKeys(key string) *redis.StringSliceCmd
- func (r *Client) HLen(key string) *redis.IntCmd
- func (r *Client) HMGet(key string, fields ...string) *redis.SliceCmd
- func (r *Client) HMSet(key string, fields map[string]interface{}) *redis.StatusCmd
- func (r *Client) HScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd
- func (r *Client) HSet(key, field string, value interface{}) *redis.BoolCmd
- func (r *Client) HSetNX(key, field string, value interface{}) *redis.BoolCmd
- func (r *Client) HVals(key string) *redis.StringSliceCmd
- func (r *Client) Incr(key string) *redis.IntCmd
- func (r *Client) IncrBy(key string, value int64) *redis.IntCmd
- func (r *Client) IsCluster() bool
- func (r *Client) LIndex(key string, index int64) *redis.StringCmd
- func (r *Client) LInsert(key, op string, pivot, value interface{}) *redis.IntCmd
- func (r *Client) LInsertAfter(key string, pivot, value interface{}) *redis.IntCmd
- func (r *Client) LInsertBefore(key string, pivot, value interface{}) *redis.IntCmd
- func (r *Client) LLen(key string) *redis.IntCmd
- func (r *Client) LPop(key string) *redis.StringCmd
- func (r *Client) LPush(key string, values ...interface{}) *redis.IntCmd
- func (r *Client) LPushX(key string, value interface{}) *redis.IntCmd
- func (r *Client) LRange(key string, start, stop int64) *redis.StringSliceCmd
- func (r *Client) LRem(key string, count int64, value interface{}) *redis.IntCmd
- func (r *Client) LSet(key string, index int64, value interface{}) *redis.StatusCmd
- func (r *Client) LTrim(key string, start, stop int64) *redis.StatusCmd
- func (r *Client) MGet(keys ...string) *redis.SliceCmd
- func (r *Client) MGetByPipeline(keys ...string) ([]string, error)
- func (r *Client) PExpire(key string, expiration time.Duration) *redis.BoolCmd
- func (r *Client) PExpireAt(key string, tm time.Time) *redis.BoolCmd
- func (r *Client) PTTL(key string) *redis.DurationCmd
- func (r *Client) Persist(key string) *redis.BoolCmd
- func (r *Client) Ping() *redis.StatusCmd
- func (r *Client) Pipeline() redis.Pipeliner
- func (r *Client) Prefix(key string) string
- func (r *Client) Publish(channel string, message interface{}) *redis.IntCmd
- func (r *Client) RPop(key string) *redis.StringCmd
- func (r *Client) RPopLPush(source, destination string) *redis.StringCmd
- func (r *Client) RPush(key string, values ...interface{}) *redis.IntCmd
- func (r *Client) RPushX(key string, value interface{}) *redis.IntCmd
- func (r *Client) SAdd(key string, members ...interface{}) *redis.IntCmd
- func (r *Client) SCard(key string) *redis.IntCmd
- func (r *Client) SDiff(keys ...string) *redis.StringSliceCmd
- func (r *Client) SDiffStore(destination string, keys ...string) *redis.IntCmd
- func (r *Client) SInter(keys ...string) *redis.StringSliceCmd
- func (r *Client) SInterStore(destination string, keys ...string) *redis.IntCmd
- func (r *Client) SIsMember(key string, member interface{}) *redis.BoolCmd
- func (r *Client) SMembers(key string) *redis.StringSliceCmd
- func (r *Client) SMove(source, destination string, member interface{}) *redis.BoolCmd
- func (r *Client) SPop(key string) *redis.StringCmd
- func (r *Client) SPopN(key string, count int64) *redis.StringSliceCmd
- func (r *Client) SRandMember(key string) *redis.StringCmd
- func (r *Client) SRandMemberN(key string, count int64) *redis.StringSliceCmd
- func (r *Client) SRem(key string, members ...interface{}) *redis.IntCmd
- func (r *Client) SScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd
- func (r *Client) SUnion(keys ...string) *redis.StringSliceCmd
- func (r *Client) SUnionStore(destination string, keys ...string) *redis.IntCmd
- func (r *Client) Scan(cursor uint64, match string, count int64) *redis.ScanCmd
- func (r *Client) Set(key string, value interface{}, expiration time.Duration) *redis.StatusCmd
- func (r *Client) Subscribe(channels ...string) *redis.PubSub
- func (r *Client) TTL(key string) *redis.DurationCmd
- func (r *Client) Type(key string) *redis.StatusCmd
- func (r *Client) Unlink(keys ...string) *redis.IntCmd
- func (r *Client) ZAdd(key string, members ...redis.Z) *redis.IntCmd
- func (r *Client) ZAddCh(key string, members ...redis.Z) *redis.IntCmd
- func (r *Client) ZAddNX(key string, members ...redis.Z) *redis.IntCmd
- func (r *Client) ZAddNXCh(key string, members ...redis.Z) *redis.IntCmd
- func (r *Client) ZAddXX(key string, members ...redis.Z) *redis.IntCmd
- func (r *Client) ZAddXXCh(key string, members ...redis.Z) *redis.IntCmd
- func (r *Client) ZCard(key string) *redis.IntCmd
- func (r *Client) ZCount(key, min, max string) *redis.IntCmd
- func (r *Client) ZIncr(key string, member redis.Z) *redis.FloatCmd
- func (r *Client) ZIncrBy(key string, increment float64, member string) *redis.FloatCmd
- func (r *Client) ZIncrNX(key string, member redis.Z) *redis.FloatCmd
- func (r *Client) ZIncrXX(key string, member redis.Z) *redis.FloatCmd
- func (r *Client) ZInterStore(key string, store redis.ZStore, keys ...string) *redis.IntCmd
- func (r *Client) ZRange(key string, start, stop int64) *redis.StringSliceCmd
- func (r *Client) ZRangeByLex(key string, opt redis.ZRangeBy) *redis.StringSliceCmd
- func (r *Client) ZRangeByScore(key string, opt redis.ZRangeBy) *redis.StringSliceCmd
- func (r *Client) ZRangeByScoreWithScores(key string, opt redis.ZRangeBy) *redis.ZSliceCmd
- func (r *Client) ZRangeWithScores(key string, start, stop int64) *redis.ZSliceCmd
- func (r *Client) ZRank(key, member string) *redis.IntCmd
- func (r *Client) ZRem(key string, members ...interface{}) *redis.IntCmd
- func (r *Client) ZRemRangeByLex(key, min, max string) *redis.IntCmd
- func (r *Client) ZRemRangeByRank(key string, start, stop int64) *redis.IntCmd
- func (r *Client) ZRemRangeByScore(key, min, max string) *redis.IntCmd
- func (r *Client) ZRevRange(key string, start, stop int64) *redis.StringSliceCmd
- func (r *Client) ZRevRangeByLex(key string, opt redis.ZRangeBy) *redis.StringSliceCmd
- func (r *Client) ZRevRangeByScore(key string, opt redis.ZRangeBy) *redis.StringSliceCmd
- func (r *Client) ZRevRangeByScoreWithScores(key string, opt redis.ZRangeBy) *redis.ZSliceCmd
- func (r *Client) ZRevRangeWithScores(key string, start, stop int64) *redis.ZSliceCmd
- func (r *Client) ZRevRank(key, member string) *redis.IntCmd
- func (r *Client) ZScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd
- func (r *Client) ZScore(key, member string) *redis.FloatCmd
- func (r *Client) ZUnionStore(dest string, store redis.ZStore, keys ...string) *redis.IntCmd
- type ClientType
- type Commander
- type Decremeter
- type Expirer
- type Getter
- type Hasher
- type Incrementer
- type Lister
- type Options
- type Pinger
- type Pipeline
- type Publisher
- type RWType
- type Scanner
- type Settable
- type Setter
- type SortedSettable
- type Subscriber
Constants ¶
const RedisNil = redis.Nil
RedisNil means nil reply, .e.g. when key does not exist.
Variables ¶
var ErrNotImplemented = errors.New("Not implemented")
ErrNotImplemented not implemented error
Functions ¶
This section is empty.
Types ¶
type BlockedSettable ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client a struct representing the redis client
func AutoConfigRedisClient ¶
AutoConfigRedisClient merges configuration files and environment variables to create redisclient. parameter priority: environment variables > configuration file
func AutoConfigRedisClientFromEnv ¶
AutoConfigRedisClientFromEnv create redisclient using purely environment variables parameters
func AutoConfigRedisClientFromVolume ¶
AutoConfigRedisClientFromVolume create redisclient using parameters in the configuration file
func (*Client) BRPopLPush ¶
func (*Client) HIncrByFloat ¶
func (*Client) LInsertAfter ¶
func (*Client) LInsertBefore ¶
func (*Client) LRange ¶
func (r *Client) LRange(key string, start, stop int64) *redis.StringSliceCmd
func (*Client) MGetByPipeline ¶
MGetByPipeline gets multiple values from keys,Pipeline is used when redis is a cluster,This means higher IO performance params: keys ...string return: []string, error
func (*Client) SDiffStore ¶
func (*Client) SInterStore ¶
func (*Client) SRandMemberN ¶
func (r *Client) SRandMemberN(key string, count int64) *redis.StringSliceCmd
func (*Client) SUnionStore ¶
func (*Client) ZInterStore ¶
func (*Client) ZRange ¶
func (r *Client) ZRange(key string, start, stop int64) *redis.StringSliceCmd
func (*Client) ZRangeByLex ¶
func (*Client) ZRangeByScore ¶
func (*Client) ZRangeByScoreWithScores ¶
func (*Client) ZRangeWithScores ¶
func (*Client) ZRemRangeByRank ¶
func (*Client) ZRemRangeByScore ¶
func (*Client) ZRevRange ¶
func (r *Client) ZRevRange(key string, start, stop int64) *redis.StringSliceCmd
func (*Client) ZRevRangeByLex ¶
func (*Client) ZRevRangeByScore ¶
func (*Client) ZRevRangeByScoreWithScores ¶
func (*Client) ZRevRangeWithScores ¶
type ClientType ¶
type ClientType string
ClientType type to define a redis client connector
const ( // ClientNormal for standard instance client ClientNormal ClientType = "normal" // ClientCluster for official redis cluster ClientCluster ClientType = "cluster" )
type Commander ¶
type Commander interface { Pinger Incrementer Decremeter Expirer Getter Hasher Lister Setter Settable SortedSettable BlockedSettable Scanner Publisher Subscriber Pipeline }
Commander an interface containing all methods
type Decremeter ¶
type Decremeter interface { Decr(key string) *redis.IntCmd DecrBy(key string, value int64) *redis.IntCmd }
Decremeter interface to decrement
type Expirer ¶
type Expirer interface { Expire(key string, expiration time.Duration) *redis.BoolCmd ExpireAt(key string, tm time.Time) *redis.BoolCmd Persist(key string) *redis.BoolCmd PExpire(key string, expiration time.Duration) *redis.BoolCmd PExpireAt(key string, tm time.Time) *redis.BoolCmd PTTL(key string) *redis.DurationCmd TTL(key string) *redis.DurationCmd }
Expirer interface for expire methods
type Getter ¶
type Getter interface { Exists(keys ...string) *redis.IntCmd Get(key string) *redis.StringCmd GetBit(key string, offset int64) *redis.IntCmd GetRange(key string, start, end int64) *redis.StringCmd GetSet(key string, value interface{}) *redis.StringCmd MGet(keys ...string) *redis.SliceCmd Dump(key string) *redis.StringCmd }
Getter interface for getting key commands
type Hasher ¶
type Hasher interface { HExists(key, field string) *redis.BoolCmd HGet(key, field string) *redis.StringCmd HGetAll(key string) *redis.StringStringMapCmd HIncrBy(key, field string, incr int64) *redis.IntCmd HIncrByFloat(key, field string, incr float64) *redis.FloatCmd HKeys(key string) *redis.StringSliceCmd HLen(key string) *redis.IntCmd HMGet(key string, fields ...string) *redis.SliceCmd HMSet(key string, fields map[string]interface{}) *redis.StatusCmd HSet(key, field string, value interface{}) *redis.BoolCmd HSetNX(key, field string, value interface{}) *redis.BoolCmd HVals(key string) *redis.StringSliceCmd HDel(key string, fields ...string) *redis.IntCmd }
Hasher interface for hashtable commands
type Incrementer ¶
type Incrementer interface { Incr(key string) *redis.IntCmd IncrBy(key string, value int64) *redis.IntCmd }
Incrementer interface to increment
type Lister ¶
type Lister interface { LIndex(key string, index int64) *redis.StringCmd LInsert(key, op string, pivot, value interface{}) *redis.IntCmd LInsertAfter(key string, pivot, value interface{}) *redis.IntCmd LInsertBefore(key string, pivot, value interface{}) *redis.IntCmd LLen(key string) *redis.IntCmd LPop(key string) *redis.StringCmd LPush(key string, values ...interface{}) *redis.IntCmd LPushX(key string, value interface{}) *redis.IntCmd LRange(key string, start, stop int64) *redis.StringSliceCmd LRem(key string, count int64, value interface{}) *redis.IntCmd LSet(key string, index int64, value interface{}) *redis.StatusCmd LTrim(key string, start, stop int64) *redis.StatusCmd RPop(key string) *redis.StringCmd RPopLPush(source, destination string) *redis.StringCmd RPush(key string, values ...interface{}) *redis.IntCmd RPushX(key string, value interface{}) *redis.IntCmd }
type Options ¶
type Options struct { Type ClientType // Host address with port number // For normal client will only used the first value Hosts []string // The network type, either tcp or unix. // Default is tcp. // Only for normal client Network string // Database to be selected after connecting to the server. Database int // Automatically adds a prefix to all keys KeyPrefix string // The maximum number of retries before giving up. Command is retried // on network errors and MOVED/ASK redirects. // Default is 16. // In normal client this is the MaxRetries option MaxRedirects int // Enables read queries for a connection to a Redis Cluster slave node. ReadOnly bool // Enables routing read-only queries to the closest master or slave node. // If set will change this client to read-only mode RouteByLatency bool // Following options are copied from Options struct. Password string // Dial timeout for establishing new connections. // Default is 5 seconds. DialTimeout time.Duration // Timeout for socket reads. If reached, commands will fail // with a timeout instead of blocking. // Default is 3 seconds. ReadTimeout time.Duration // Timeout for socket writes. If reached, commands will fail // with a timeout instead of blocking. // Default is 3 seconds. WriteTimeout time.Duration // PoolSize applies per cluster node and not for the whole cluster. // Maximum number of socket connections. // Default is 10 connections. PoolSize int // Amount of time client waits for connection if all connections // are busy before returning an error. // Default is ReadTimeout + 1 second. PoolTimeout time.Duration // Amount of time after which client closes idle connections. // Should be less than server's timeout. // Default is to not close idle connections. IdleTimeout time.Duration // Frequency of idle checks. // Default is 1 minute. // When minus value is set, then idle check is disabled. IdleCheckFrequency time.Duration // TLS Config to use. When set TLS will be negotiated. // Only for normal client TLSConfig *tls.Config }
Options options to initiate your client
func (Options) GetClusterConfig ¶
func (o Options) GetClusterConfig() *redis.ClusterOptions
GetClusterConfig translates current configuration into a *redis.ClusterOptions
func (Options) GetNormalConfig ¶
GetNormalConfig translates current configuration into a *redis.Options struct
type RWType ¶
type RWType string
Client Reader and Writer
func (*RWType) IsReadOnly ¶
IsReadOnly will return Is it read-only
type Scanner ¶
type Scanner interface { Type(key string) *redis.StatusCmd Scan(cursor uint64, match string, count int64) *redis.ScanCmd SScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd HScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd ZScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd }
type Settable ¶
type Settable interface { SAdd(key string, members ...interface{}) *redis.IntCmd SCard(key string) *redis.IntCmd SDiff(keys ...string) *redis.StringSliceCmd SDiffStore(destination string, keys ...string) *redis.IntCmd SInter(keys ...string) *redis.StringSliceCmd SInterStore(destination string, keys ...string) *redis.IntCmd SIsMember(key string, member interface{}) *redis.BoolCmd SMembers(key string) *redis.StringSliceCmd SMove(source, destination string, member interface{}) *redis.BoolCmd SPop(key string) *redis.StringCmd SPopN(key string, count int64) *redis.StringSliceCmd SRandMember(key string) *redis.StringCmd SRandMemberN(key string, count int64) *redis.StringSliceCmd SRem(key string, members ...interface{}) *redis.IntCmd SUnion(keys ...string) *redis.StringSliceCmd SUnionStore(destination string, keys ...string) *redis.IntCmd }
type Setter ¶
type Setter interface { Set(key string, value interface{}, expiration time.Duration) *redis.StatusCmd Append(key, value string) *redis.IntCmd Del(keys ...string) *redis.IntCmd Unlink(keys ...string) *redis.IntCmd }
Setter interface for setting key commands
type SortedSettable ¶
type SortedSettable interface { ZAdd(key string, members ...redis.Z) *redis.IntCmd ZAddNX(key string, members ...redis.Z) *redis.IntCmd ZAddXX(key string, members ...redis.Z) *redis.IntCmd ZAddCh(key string, members ...redis.Z) *redis.IntCmd ZAddNXCh(key string, members ...redis.Z) *redis.IntCmd ZAddXXCh(key string, members ...redis.Z) *redis.IntCmd ZIncr(key string, member redis.Z) *redis.FloatCmd ZIncrNX(key string, member redis.Z) *redis.FloatCmd ZIncrXX(key string, member redis.Z) *redis.FloatCmd ZCard(key string) *redis.IntCmd ZCount(key, min, max string) *redis.IntCmd ZIncrBy(key string, increment float64, member string) *redis.FloatCmd ZInterStore(destination string, store redis.ZStore, keys ...string) *redis.IntCmd ZRange(key string, start, stop int64) *redis.StringSliceCmd ZRangeWithScores(key string, start, stop int64) *redis.ZSliceCmd ZRangeByScore(key string, opt redis.ZRangeBy) *redis.StringSliceCmd ZRangeByLex(key string, opt redis.ZRangeBy) *redis.StringSliceCmd ZRangeByScoreWithScores(key string, opt redis.ZRangeBy) *redis.ZSliceCmd ZRank(key, member string) *redis.IntCmd ZRem(key string, members ...interface{}) *redis.IntCmd ZRemRangeByRank(key string, start, stop int64) *redis.IntCmd ZRemRangeByScore(key, min, max string) *redis.IntCmd ZRemRangeByLex(key, min, max string) *redis.IntCmd ZRevRange(key string, start, stop int64) *redis.StringSliceCmd ZRevRangeWithScores(key string, start, stop int64) *redis.ZSliceCmd ZRevRangeByScore(key string, opt redis.ZRangeBy) *redis.StringSliceCmd ZRevRangeByLex(key string, opt redis.ZRangeBy) *redis.StringSliceCmd ZRevRangeByScoreWithScores(key string, opt redis.ZRangeBy) *redis.ZSliceCmd ZRevRank(key, member string) *redis.IntCmd ZScore(key, member string) *redis.FloatCmd ZUnionStore(dest string, store redis.ZStore, keys ...string) *redis.IntCmd }