Documentation
¶
Index ¶
- type ClusterRedis
- func (s *ClusterRedis) Connect() error
- func (s *ClusterRedis) Del(key string) error
- func (s *ClusterRedis) DisConnect() error
- func (s *ClusterRedis) Exists(key string) bool
- func (s *ClusterRedis) Expire(key string, dur time.Duration) error
- func (s *ClusterRedis) Get(key string) (string, error)
- func (s *ClusterRedis) GetDel(key string) (string, error)
- func (s *ClusterRedis) HDel(key, field string) error
- func (s *ClusterRedis) HExists(key, field string) error
- func (s *ClusterRedis) HGet(key, field string) (string, error)
- func (s *ClusterRedis) HGetAll(key string) (map[string]string, error)
- func (s *ClusterRedis) HSet(key, field, value string) error
- func (s *ClusterRedis) Incr(key string) (int64, error)
- func (s *ClusterRedis) List() ([]store.Entry, error)
- func (s *ClusterRedis) Set(key, value string, expire time.Duration) error
- type Redis
- func (s *Redis) Del(key string) error
- func (s *Redis) Exists(key string) bool
- func (s *Redis) Expire(key string, dur time.Duration) error
- func (s *Redis) Get(key string) (string, error)
- func (s *Redis) GetDel(key string) (string, error)
- func (s *Redis) HDel(key, field string) error
- func (s *Redis) HExists(key, field string) error
- func (s *Redis) HGet(key, field string) (string, error)
- func (s *Redis) HGetAll(key string) (map[string]string, error)
- func (s *Redis) HSet(key, field, value string) error
- func (s *Redis) Incr(key string) (int64, error)
- func (s *Redis) List() ([]store.Entry, error)
- func (s *Redis) Set(key, value string, expire time.Duration) error
- type Store
- func (s *Store) Close() error
- func (s *Store) Delete(ctx context.Context, key string) error
- func (s *Store) Get(ctx context.Context, key string) ([]byte, error)
- func (s *Store) GetDel(ctx context.Context, key string) ([]byte, error)
- func (s *Store) GetMulti(ctx context.Context, keys []string) ([][]byte, error)
- func (s *Store) Has(ctx context.Context, key string) (bool, error)
- func (s *Store) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error
- func (s *Store) SetMulti(ctx context.Context, items []store.Item) error
- func (s *Store) SetNX(ctx context.Context, key string, value []byte, ttl time.Duration) (bool, error)
- type StoreOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClusterRedis ¶
type ClusterRedis struct {
// contains filtered or unexported fields
}
ClusterRedis 表示 Redis 集群缓存客户端。
func NewClusterRedis ¶
func NewClusterRedis(cfg *configv1.Data_Redis) (*ClusterRedis, func(), error)
NewClusterRedis 创建 Redis 集群缓存实例。
func (*ClusterRedis) Connect ¶
func (s *ClusterRedis) Connect() error
func (*ClusterRedis) Del ¶
func (s *ClusterRedis) Del(key string) error
func (*ClusterRedis) DisConnect ¶
func (s *ClusterRedis) DisConnect() error
func (*ClusterRedis) Exists ¶
func (s *ClusterRedis) Exists(key string) bool
func (*ClusterRedis) GetDel ¶ added in v0.0.16
func (s *ClusterRedis) GetDel(key string) (string, error)
GetDel 使用 Redis GETDEL 原子读取并删除缓存值。
func (*ClusterRedis) HDel ¶
func (s *ClusterRedis) HDel(key, field string) error
func (*ClusterRedis) HExists ¶
func (s *ClusterRedis) HExists(key, field string) error
func (*ClusterRedis) HGetAll ¶
func (s *ClusterRedis) HGetAll(key string) (map[string]string, error)
func (*ClusterRedis) HSet ¶
func (s *ClusterRedis) HSet(key, field, value string) error
func (*ClusterRedis) Incr ¶ added in v0.0.19
func (s *ClusterRedis) Incr(key string) (int64, error)
Incr 原子递增 Redis 集群中的数值键。
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
func NewRedis ¶
func NewRedis(cfg *configv1.Data_Redis) (*Redis, func(), error)
NewRedis 创建单机 Redis 缓存实例。
type Store ¶ added in v0.0.16
type Store struct {
// contains filtered or unexported fields
}
Store 是支持 context、GetDel、SetNX 和批量操作的 Redis 缓存。
func NewStore ¶ added in v0.0.16
func NewStore(client redis.UniversalClient, opts ...StoreOption) *Store
NewStore 创建基于 Redis UniversalClient 的现代缓存实现。 Store 不接管 client 生命周期,Close 不会关闭底层 Redis 客户端。
type StoreOption ¶ added in v0.0.16
type StoreOption func(*storeConfig)
StoreOption 配置 Redis Store。
func WithStoreKeyPrefix ¶ added in v0.0.16
func WithStoreKeyPrefix(prefix string) StoreOption
WithStoreKeyPrefix 设置 Redis Store 的缓存键前缀。
Click to show internal directories.
Click to hide internal directories.