Documentation ¶
Index ¶
- func BLPop(key string, val any) error
- func BLPopString(key string) (string, error)
- func BRPop(key string, val any) error
- func BRPopString(key string) (string, error)
- func Decr(key string) (int64, error)
- func Del(keys ...string) (int64, error)
- func DelPattern(pattern string) (int64, error)
- func Exists(keys ...string) bool
- func Expire(key string, expiration time.Duration) bool
- func FlushAll() error
- func FlushAllAsync() error
- func FlushDB() error
- func FlushDBAsync() error
- func Get(key string, val any) error
- func GetInt(key string) int
- func GetKey(key string) string
- func GetProto(key string, val proto.Message) error
- func GetString(key string) string
- func HDel(key string, fields ...string) error
- func HDelAll(key string)
- func HExists(key, field string) bool
- func HGet(key, field string, val any) error
- func HGetAll(key string) (map[string]string, error)
- func HGetRaw(key, field string) ([]byte, error)
- func HIncrBy(key, field string, incr int64) int64
- func HKeys(key string) ([]string, error)
- func HMGet(key string, fields []string) []any
- func HSet(key, field string, val any) error
- func HSetNx(key, field string, val any) error
- func HSetRaw(key, field string, val any) error
- func Incr(key string) (int64, error)
- func InitStoreKeeper(cfg config.StoresConf)
- func IsRedisNull(err error) bool
- func LLen(key string) int64
- func LPop(key string, val any) error
- func LPush(key string, values ...any) error
- func Lock(key string) (*redsync.Mutex, context.Context, error)
- func RPop(key string, val any) error
- func RPush(key string, values ...any) error
- func SAdd(key string, members ...interface{}) error
- func SCard(key string) int64
- func SIsMember(key string, member interface{}) bool
- func SMembers(key string) []string
- func SPop(key string) string
- func SPopN(key string, count int64) []string
- func SRandMember(key string) string
- func SRandMemberN(key string, count int64) []string
- func SRem(key string, members ...interface{}) error
- func Set(key string, value any, expire time.Duration) error
- func SetNx(key string, value any, expire time.Duration) error
- func SetProto(key string, value proto.Message, expire time.Duration) error
- func SetProtoNx(key string, value proto.Message, expire time.Duration) error
- func TxPipeline() redis.Pipeliner
- func Unlock(mutex *redsync.Mutex, ctx context.Context) error
- func ZAdd(key string, members ...*redis.Z) error
- func ZCard(key string) int64
- func ZIncrBy(key string, increment float64, member string) (float64, error)
- func ZRangeWithScores(key string, start, stop int64) ([]redis.Z, error)
- func ZRank(key, member string) (int64, error)
- func ZRem(key string, members ...any) error
- func ZRemRangeByScore(key string, min, max string) error
- func ZRevRangeWithScores(key string, start, stop int64) ([]redis.Z, error)
- func ZRevRank(key, member string) (int64, error)
- func ZScore(key, member string) float64
- type StoreKeeper
- type StoreMem
- func (s *StoreMem) Bool(key string) bool
- func (s *StoreMem) Clear()
- func (s *StoreMem) Data() map[string]any
- func (s *StoreMem) Float32(key string) float32
- func (s *StoreMem) Float64(key string) float64
- func (s *StoreMem) HasKey(key string) bool
- func (s *StoreMem) Int(key string) int
- func (s *StoreMem) Int16(key string) int16
- func (s *StoreMem) Int32(key string) int32
- func (s *StoreMem) Int64(key string) int64
- func (s *StoreMem) Int8(key string) int8
- func (s *StoreMem) Remove(key string)
- func (s *StoreMem) Restore(data map[string]any)
- func (s *StoreMem) Set(key string, value any)
- func (s *StoreMem) String(key string) string
- func (s *StoreMem) Uint(key string) uint
- func (s *StoreMem) Uint16(key string) uint16
- func (s *StoreMem) Uint32(key string) uint32
- func (s *StoreMem) Uint64(key string) uint64
- func (s *StoreMem) Uint8(key string) uint8
- func (s *StoreMem) Value(key string) any
- type StoreRedis
- func (s *StoreRedis) BLPop(key string, val any) error
- func (s *StoreRedis) BLPopString(key string) (string, error)
- func (s *StoreRedis) BRPop(key string, val any) error
- func (s *StoreRedis) BRPopString(key string) (string, error)
- func (s *StoreRedis) Decr(key string) (int64, error)
- func (s *StoreRedis) Del(keys ...string) (int64, error)
- func (s *StoreRedis) DelPattern(pattern string) (int64, error)
- func (s *StoreRedis) Exists(keys ...string) bool
- func (s *StoreRedis) Expire(key string, expiration time.Duration) bool
- func (s *StoreRedis) FlushAll() error
- func (s *StoreRedis) FlushAllAsync() error
- func (s *StoreRedis) FlushDB() error
- func (s *StoreRedis) FlushDBAsync() error
- func (s *StoreRedis) Get(key string, val any) error
- func (s *StoreRedis) GetInt(key string) int
- func (s *StoreRedis) GetKey(key string) string
- func (s *StoreRedis) GetKeys(keys []string) []string
- func (s *StoreRedis) GetProto(key string, val proto.Message) error
- func (s *StoreRedis) GetString(key string) string
- func (s *StoreRedis) GetValues(values []any) []any
- func (s *StoreRedis) HDel(key string, fields ...string) error
- func (s *StoreRedis) HDelAll(key string)
- func (s *StoreRedis) HExists(key, field string) bool
- func (s *StoreRedis) HGet(key, field string, val any) error
- func (s *StoreRedis) HGetAll(key string) (map[string]string, error)
- func (s *StoreRedis) HGetRaw(key, field string) ([]byte, error)
- func (s *StoreRedis) HIncrBy(key, field string, incr int64) int64
- func (s *StoreRedis) HKeys(key string) ([]string, error)
- func (s *StoreRedis) HMGet(key string, fields []string) []any
- func (s *StoreRedis) HSet(key, field string, val any) error
- func (s *StoreRedis) HSetNx(key, field string, val any) error
- func (s *StoreRedis) HSetRaw(key, field string, val any) error
- func (s *StoreRedis) Incr(key string) (int64, error)
- func (s *StoreRedis) IsRedisNull(err error) bool
- func (s *StoreRedis) LLen(key string) int64
- func (s *StoreRedis) LPop(key string, val any) error
- func (s *StoreRedis) LPush(key string, values ...any) error
- func (s *StoreRedis) Lock(key string) (*redsync.Mutex, context.Context, error)
- func (s *StoreRedis) RPop(key string, val any) error
- func (s *StoreRedis) RPush(key string, values ...any) error
- func (s *StoreRedis) SAdd(key string, members ...interface{}) error
- func (s *StoreRedis) SCard(key string) int64
- func (s *StoreRedis) SIsMember(key string, member interface{}) bool
- func (s *StoreRedis) SMembers(key string) []string
- func (s *StoreRedis) SPop(key string) string
- func (s *StoreRedis) SPopN(key string, count int64) []string
- func (s *StoreRedis) SRandMember(key string) string
- func (s *StoreRedis) SRandMemberN(key string, count int64) []string
- func (s *StoreRedis) SRem(key string, members ...interface{}) error
- func (s *StoreRedis) Set(key string, value any, expire time.Duration) error
- func (s *StoreRedis) SetNx(key string, value any, expire time.Duration) error
- func (s *StoreRedis) SetProto(key string, value proto.Message, expire time.Duration) error
- func (s *StoreRedis) SetProtoNx(key string, value proto.Message, expire time.Duration) error
- func (s *StoreRedis) TxPipeline() redis.Pipeliner
- func (s *StoreRedis) Unlock(mutex *redsync.Mutex, ctx context.Context) error
- func (s *StoreRedis) ZAdd(key string, members ...*redis.Z) error
- func (s *StoreRedis) ZCard(key string) int64
- func (s *StoreRedis) ZIncrBy(key string, increment float64, member string) (float64, error)
- func (s *StoreRedis) ZRangeWithScores(key string, start, stop int64) ([]redis.Z, error)
- func (s *StoreRedis) ZRank(key, member string) (int64, error)
- func (s *StoreRedis) ZRem(key string, members ...any) error
- func (s *StoreRedis) ZRemRangeByScore(key string, min, max string) error
- func (s *StoreRedis) ZRevRangeWithScores(key string, start, stop int64) ([]redis.Z, error)
- func (s *StoreRedis) ZRevRank(key, member string) (int64, error)
- func (s *StoreRedis) ZScore(key, member string) float64
- type StoreRedisOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BLPopString ¶
func BRPopString ¶
func DelPattern ¶ added in v2.6.5
func FlushAllAsync ¶
func FlushAllAsync() error
func FlushDBAsync ¶
func FlushDBAsync() error
func InitStoreKeeper ¶
func InitStoreKeeper(cfg config.StoresConf)
func IsRedisNull ¶
func SRandMember ¶ added in v2.8.7
func SRandMemberN ¶ added in v2.8.7
func SetProtoNx ¶ added in v2.0.3
func TxPipeline ¶ added in v2.0.3
func TxPipeline() redis.Pipeliner
func ZRangeWithScores ¶
func ZRemRangeByScore ¶ added in v2.9.0
func ZRevRangeWithScores ¶
Types ¶
type StoreKeeper ¶
type StoreKeeper interface { Set(key string, value any, expire time.Duration) error SetNx(key string, value any, expire time.Duration) error //set if not exist SetProto(key string, value proto.Message, expire time.Duration) error SetProtoNx(key string, value proto.Message, expire time.Duration) error Get(key string, val any) error GetInt(key string) int GetString(key string) string GetProto(key string, val proto.Message) error Del(keys ...string) (int64, error) DelPattern(pattern string) (int64, error) Exists(keys ...string) bool HSet(key, field string, val any) error HSetRaw(key, field string, val any) error HSetNx(key, field string, val any) error HIncrBy(key, field string, incr int64) int64 HGet(key, field string, val any) error HMGet(key string, fields []string) []any HGetRaw(key, field string) ([]byte, error) HGetAll(key string) (map[string]string, error) HDel(key string, fields ...string) error HDelAll(key string) HExists(key, field string) bool Expire(key string, expiration time.Duration) bool HKeys(key string) ([]string, error) SAdd(key string, members ...interface{}) error SCard(key string) int64 SRem(key string, members ...interface{}) error SMembers(key string) []string SRandMember(key string) string SRandMemberN(key string, count int64) []string SPop(key string) string SPopN(key string, count int64) []string SIsMember(key string, member interface{}) bool ZAdd(key string, members ...*redis.Z) error ZRangeWithScores(key string, start, stop int64) ([]redis.Z, error) ZRevRangeWithScores(key string, start, stop int64) ([]redis.Z, error) ZRank(key, member string) (int64, error) ZRevRank(key, member string) (int64, error) ZScore(key, member string) float64 ZIncrBy(key string, increment float64, member string) (float64, error) ZRem(key string, members ...any) error ZRemRangeByScore(key string, min, max string) error ZCard(key string) int64 LPush(key string, values ...any) error RPush(key string, values ...any) error LPop(key string, val any) error RPop(key string, val any) error BLPop(key string, val any) error BRPop(key string, val any) error BLPopString(key string) (string, error) BRPopString(key string) (string, error) Incr(key string) (int64, error) Decr(key string) (int64, error) LLen(key string) int64 IsRedisNull(err error) bool FlushDB() error FlushDBAsync() error FlushAll() error FlushAllAsync() error Lock(key string) (*redsync.Mutex, context.Context, error) Unlock(mutex *redsync.Mutex, ctx context.Context) error TxPipeline() redis.Pipeliner GetKey(key string) string }
StoreKeeper stores interface
func GetDefStoreKeeper ¶ added in v2.5.0
func GetDefStoreKeeper() StoreKeeper
type StoreMem ¶ added in v2.3.1
func NewStoreMem ¶ added in v2.3.1
func NewStoreMem() *StoreMem
func (*StoreMem) Clear ¶ added in v2.3.1
func (s *StoreMem) Clear()
Clear releases all data related to current session
func (*StoreMem) Float32 ¶ added in v2.3.1
Float32 returns the value associated with the key as a float32.
func (*StoreMem) Float64 ¶ added in v2.3.1
Float64 returns the value associated with the key as a float64.
func (*StoreMem) Int16 ¶ added in v2.3.1
Int16 returns the value associated with the key as a int16.
func (*StoreMem) Int32 ¶ added in v2.3.1
Int32 returns the value associated with the key as a int32.
func (*StoreMem) Int64 ¶ added in v2.3.1
Int64 returns the value associated with the key as a int64.
func (*StoreMem) Remove ¶ added in v2.3.1
Remove delete data associated with the key from session storage
func (*StoreMem) String ¶ added in v2.3.1
String returns the value associated with the key as a string.
func (*StoreMem) Uint16 ¶ added in v2.3.1
Uint16 returns the value associated with the key as a uint16.
func (*StoreMem) Uint32 ¶ added in v2.3.1
Uint32 returns the value associated with the key as a uint32.
func (*StoreMem) Uint64 ¶ added in v2.3.1
Uint64 returns the value associated with the key as a uint64.
type StoreRedis ¶
type StoreRedis struct { Endpoints []string Password string DB int DialTimeout time.Duration Client *redis.Client Prefix string // contains filtered or unexported fields }
func NewStoreRedis ¶
func NewStoreRedis(opts ...StoreRedisOption) *StoreRedis
func (*StoreRedis) BLPopString ¶
func (s *StoreRedis) BLPopString(key string) (string, error)
func (*StoreRedis) BRPopString ¶
func (s *StoreRedis) BRPopString(key string) (string, error)
func (*StoreRedis) DelPattern ¶ added in v2.6.5
func (s *StoreRedis) DelPattern(pattern string) (int64, error)
func (*StoreRedis) Exists ¶
func (s *StoreRedis) Exists(keys ...string) bool
func (*StoreRedis) FlushAll ¶
func (s *StoreRedis) FlushAll() error
func (*StoreRedis) FlushAllAsync ¶
func (s *StoreRedis) FlushAllAsync() error
func (*StoreRedis) FlushDB ¶
func (s *StoreRedis) FlushDB() error
func (*StoreRedis) FlushDBAsync ¶
func (s *StoreRedis) FlushDBAsync() error
func (*StoreRedis) GetInt ¶
func (s *StoreRedis) GetInt(key string) int
func (*StoreRedis) GetKey ¶
func (s *StoreRedis) GetKey(key string) string
func (*StoreRedis) GetKeys ¶
func (s *StoreRedis) GetKeys(keys []string) []string
func (*StoreRedis) GetProto ¶ added in v2.0.3
func (s *StoreRedis) GetProto(key string, val proto.Message) error
func (*StoreRedis) GetString ¶
func (s *StoreRedis) GetString(key string) string
func (*StoreRedis) GetValues ¶
func (s *StoreRedis) GetValues(values []any) []any
func (*StoreRedis) HDelAll ¶
func (s *StoreRedis) HDelAll(key string)
func (*StoreRedis) HExists ¶
func (s *StoreRedis) HExists(key, field string) bool
func (*StoreRedis) HGetRaw ¶ added in v2.9.2
func (s *StoreRedis) HGetRaw(key, field string) ([]byte, error)
func (*StoreRedis) HIncrBy ¶ added in v2.4.7
func (s *StoreRedis) HIncrBy(key, field string, incr int64) int64
func (*StoreRedis) HMGet ¶ added in v2.10.11
func (s *StoreRedis) HMGet(key string, fields []string) []any
func (*StoreRedis) HSetNx ¶ added in v2.8.0
func (s *StoreRedis) HSetNx(key, field string, val any) error
func (*StoreRedis) HSetRaw ¶ added in v2.9.2
func (s *StoreRedis) HSetRaw(key, field string, val any) error
func (*StoreRedis) IsRedisNull ¶
func (s *StoreRedis) IsRedisNull(err error) bool
func (*StoreRedis) LLen ¶
func (s *StoreRedis) LLen(key string) int64
func (*StoreRedis) Lock ¶ added in v2.0.3
func (s *StoreRedis) Lock(key string) (*redsync.Mutex, context.Context, error)
func (*StoreRedis) SAdd ¶ added in v2.4.6
func (s *StoreRedis) SAdd(key string, members ...interface{}) error
func (*StoreRedis) SCard ¶ added in v2.4.6
func (s *StoreRedis) SCard(key string) int64
func (*StoreRedis) SIsMember ¶ added in v2.4.6
func (s *StoreRedis) SIsMember(key string, member interface{}) bool
func (*StoreRedis) SMembers ¶ added in v2.4.6
func (s *StoreRedis) SMembers(key string) []string
func (*StoreRedis) SPop ¶ added in v2.8.8
func (s *StoreRedis) SPop(key string) string
func (*StoreRedis) SPopN ¶ added in v2.8.8
func (s *StoreRedis) SPopN(key string, count int64) []string
func (*StoreRedis) SRandMember ¶ added in v2.8.7
func (s *StoreRedis) SRandMember(key string) string
func (*StoreRedis) SRandMemberN ¶ added in v2.8.7
func (s *StoreRedis) SRandMemberN(key string, count int64) []string
func (*StoreRedis) SRem ¶ added in v2.4.6
func (s *StoreRedis) SRem(key string, members ...interface{}) error
func (*StoreRedis) SetProtoNx ¶ added in v2.0.3
func (*StoreRedis) TxPipeline ¶ added in v2.0.3
func (s *StoreRedis) TxPipeline() redis.Pipeliner
func (*StoreRedis) Unlock ¶ added in v2.0.3
func (s *StoreRedis) Unlock(mutex *redsync.Mutex, ctx context.Context) error
func (*StoreRedis) ZAdd ¶
func (s *StoreRedis) ZAdd(key string, members ...*redis.Z) error
func (*StoreRedis) ZCard ¶
func (s *StoreRedis) ZCard(key string) int64
func (*StoreRedis) ZRangeWithScores ¶
func (s *StoreRedis) ZRangeWithScores(key string, start, stop int64) ([]redis.Z, error)
func (*StoreRedis) ZRank ¶ added in v2.9.0
func (s *StoreRedis) ZRank(key, member string) (int64, error)
func (*StoreRedis) ZRemRangeByScore ¶ added in v2.9.0
func (s *StoreRedis) ZRemRangeByScore(key string, min, max string) error
func (*StoreRedis) ZRevRangeWithScores ¶
func (s *StoreRedis) ZRevRangeWithScores(key string, start, stop int64) ([]redis.Z, error)
func (*StoreRedis) ZScore ¶
func (s *StoreRedis) ZScore(key, member string) float64
type StoreRedisOption ¶
type StoreRedisOption func(s *StoreRedis)
func WithRedisDB ¶
func WithRedisDB(DB int) StoreRedisOption
func WithRedisDialTimeout ¶
func WithRedisDialTimeout(timeout time.Duration) StoreRedisOption
func WithRedisEndpoints ¶
func WithRedisEndpoints(endpoints []string) StoreRedisOption
func WithRedisPassword ¶
func WithRedisPassword(password string) StoreRedisOption
func WithRedisPrefix ¶
func WithRedisPrefix(prefix string) StoreRedisOption