Documentation
¶
Index ¶
- func AddPrefix(key string) string
- func Client() interface{}
- func DecrFloat(ctx context.Context, key string, value float64) (float64, error)
- func DecrInt(ctx context.Context, key string, value int64) (int64, error)
- func Delete(ctx context.Context, keys ...string) (bool, error)
- func Has(ctx context.Context, key string) (bool, error)
- func IncrFloat(ctx context.Context, key string, value float64) (float64, error)
- func IncrInt(ctx context.Context, key string, value int64) (int64, error)
- func Set(ctx context.Context, key string, value interface{}, ...) error
- func SetCache(cache Cache)
- type Cache
- type Result
- type SetValueFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache interface { // Has 检测缓存是否存在 Has(ctx context.Context, key string) (bool, error) // Get 获取缓存值 Get(ctx context.Context, key string, def ...interface{}) Result // Set 设置缓存值 Set(ctx context.Context, key string, value interface{}, expiration ...time.Duration) error // GetSet 获取设置缓存值 GetSet(ctx context.Context, key string, fn SetValueFunc) Result // Delete 删除缓存 Delete(ctx context.Context, keys ...string) (bool, error) // IncrInt 整数自增 IncrInt(ctx context.Context, key string, value int64) (int64, error) // IncrFloat 浮点数自增 IncrFloat(ctx context.Context, key string, value float64) (float64, error) // DecrInt 整数自减 DecrInt(ctx context.Context, key string, value int64) (int64, error) // DecrFloat 浮点数自减 DecrFloat(ctx context.Context, key string, value float64) (float64, error) // AddPrefix 添加Key前缀 AddPrefix(key string) string // Client 获取客户端 Client() interface{} }
type Result ¶
type Result interface { Err() error Result() (value.Value, error) Int() (int, error) Int8() (int8, error) Int16() (int16, error) Int32() (int32, error) Int64() (int64, error) Uint() (uint, error) Uint8() (uint8, error) Uint16() (uint16, error) Uint32() (uint32, error) Uint64() (uint64, error) Float32() (float32, error) Float64() (float64, error) Bool() (bool, error) String() (string, error) Duration() (time.Duration, error) Ints() ([]int, error) Int8s() ([]int8, error) Int16s() ([]int16, error) Int32s() ([]int32, error) Int64s() ([]int64, error) Uints() ([]uint, error) Uint8s() ([]uint8, error) Uint16s() ([]uint16, error) Uint32s() ([]uint32, error) Uint64s() ([]uint64, error) Float32s() ([]float32, error) Float64s() ([]float64, error) Bools() ([]bool, error) Strings() ([]string, error) Bytes() ([]byte, error) Durations() ([]time.Duration, error) Slice() ([]interface{}, error) Map() (map[string]interface{}, error) Scan(pointer interface{}) error }
type SetValueFunc ¶
type SetValueFunc func() (interface{}, error)
Click to show internal directories.
Click to hide internal directories.