Documentation
¶
Index ¶
- Constants
- Variables
- func RandomExpirationDuration() time.Duration
- type Client
- func (cli *Client) CheckAndGet(ctx context.Context, key string) (string, error)
- func (cli *Client) CheckAndScan(ctx context.Context, dst any, key string) error
- func (cli *Client) Del(ctx context.Context, keys ...string) error
- func (cli *Client) Exists(ctx context.Context, keys ...string) (int64, error)
- func (cli *Client) Expire(ctx context.Context, key string, expiration time.Duration) error
- func (cli *Client) ExpireAt(ctx context.Context, key string, at time.Time) error
- func (cli *Client) Get(ctx context.Context, key string) (string, error)
- func (cli *Client) GetAndScan(ctx context.Context, dst any, key string) error
- func (cli *Client) HDel(ctx context.Context, key string, fields ...string) error
- func (cli *Client) HGet(ctx context.Context, key, field string) (string, error)
- func (cli *Client) HGetAndScan(ctx context.Context, dst any, key, field string) error
- func (cli *Client) HKeys(ctx context.Context, key string) ([]string, error)
- func (cli *Client) HKeysAndScan(ctx context.Context, dst any, key string) error
- func (cli *Client) HLen(ctx context.Context, key string) (int64, error)
- func (cli *Client) HMGet(ctx context.Context, key string, fields ...string) ([]any, error)
- func (cli *Client) HMGetAndScan(ctx context.Context, dst any, key string, fields ...string) error
- func (cli *Client) HSet(ctx context.Context, key string, values ...any) error
- func (cli *Client) HVals(ctx context.Context, key string) ([]string, error)
- func (cli *Client) HValsAndScan(ctx context.Context, dst any, key string) error
- func (cli *Client) MGet(ctx context.Context, keys ...string) ([]any, error)
- func (cli *Client) MGetAndScan(ctx context.Context, dst any, keys ...string) error
- func (cli *Client) Pop(ctx context.Context, key string) (string, error)
- func (cli *Client) PopAndScan(ctx context.Context, dst any, key string) error
- func (cli *Client) Push(ctx context.Context, key string, data ...any) error
- func (cli *Client) Rang(ctx context.Context, key string, start, stop int64) ([]string, error)
- func (cli *Client) RangAndScan(ctx context.Context, dst any, key string, start, stop int64) error
- func (cli *Client) Set(ctx context.Context, key string, data any, expiration time.Duration) error
- func (cli *Client) SetNX(ctx context.Context, key string, data any, expiration time.Duration) error
- func (cli *Client) Trim(ctx context.Context, key string, start, stop int64) error
- type HashClient
- func (cli *HashClient) Del(ctx context.Context, keys ...string) error
- func (cli *HashClient) Exists(ctx context.Context, keys ...string) (int64, error)
- func (cli *HashClient) Expire(ctx context.Context, key string, expiration time.Duration) error
- func (cli *HashClient) ExpireAt(ctx context.Context, key string, at time.Time) error
- func (cli *HashClient) HDel(ctx context.Context, key string, fields ...string) error
- func (cli *HashClient) HGet(ctx context.Context, key, field string) (string, error)
- func (cli *HashClient) HGetAndScan(ctx context.Context, dst any, key, field string) error
- func (cli *HashClient) HKeys(ctx context.Context, key string) ([]string, error)
- func (cli *HashClient) HKeysAndScan(ctx context.Context, dst any, key string) error
- func (cli *HashClient) HLen(ctx context.Context, key string) (int64, error)
- func (cli *HashClient) HMGet(ctx context.Context, key string, fields ...string) ([]any, error)
- func (cli *HashClient) HMGetAndScan(ctx context.Context, dst any, key string, fields ...string) error
- func (cli *HashClient) HSet(ctx context.Context, key string, values ...any) error
- func (cli *HashClient) HVals(ctx context.Context, key string) ([]string, error)
- func (cli *HashClient) HValsAndScan(ctx context.Context, dst any, key string) error
- type ListClient
- func (cli *ListClient) Del(ctx context.Context, keys ...string) error
- func (cli *ListClient) Exists(ctx context.Context, keys ...string) (int64, error)
- func (cli *ListClient) Expire(ctx context.Context, key string, expiration time.Duration) error
- func (cli *ListClient) ExpireAt(ctx context.Context, key string, at time.Time) error
- func (cli *ListClient) Pop(ctx context.Context, key string) (string, error)
- func (cli *ListClient) PopAndScan(ctx context.Context, dst any, key string) error
- func (cli *ListClient) Push(ctx context.Context, key string, data ...any) error
- func (cli *ListClient) Rang(ctx context.Context, key string, start, stop int64) ([]string, error)
- func (cli *ListClient) RangAndScan(ctx context.Context, dst any, key string, start, stop int64) error
- func (cli *ListClient) Trim(ctx context.Context, key string, start, stop int64) error
- type StringClient
- func (cli *StringClient) CheckAndGet(ctx context.Context, key string) (string, error)
- func (cli *StringClient) CheckAndScan(ctx context.Context, dst any, key string) error
- func (cli *StringClient) Del(ctx context.Context, keys ...string) error
- func (cli *StringClient) Exists(ctx context.Context, keys ...string) (int64, error)
- func (cli *StringClient) Expire(ctx context.Context, key string, expiration time.Duration) error
- func (cli *StringClient) ExpireAt(ctx context.Context, key string, at time.Time) error
- func (cli *StringClient) Get(ctx context.Context, key string) (string, error)
- func (cli *StringClient) GetAndScan(ctx context.Context, dst any, key string) error
- func (cli *StringClient) MGet(ctx context.Context, keys ...string) ([]any, error)
- func (cli *StringClient) MGetAndScan(ctx context.Context, dst any, keys ...string) error
- func (cli *StringClient) Set(ctx context.Context, key string, data any, expiration time.Duration) error
- func (cli *StringClient) SetNX(ctx context.Context, key string, data any, expiration time.Duration) error
Constants ¶
View Source
const ( // KeepTTL 保持原先的过期时间(TTL) KeepTTL = -1 // DefaultEmptySetNXDuration 默认空对象设置过期时效 DefaultEmptySetNXDuration = time.Second * 10 // DefaultExpirationDuration 默认缓存过期时效 DefaultExpirationDuration = time.Hour )
Variables ¶
Functions ¶
func RandomExpirationDuration ¶
RandomExpirationDuration 以 DefaultExpirationDuration 为基础,返回一个 DefaultExpirationDuration ± 30m 内的时间长度
Types ¶
type Client ¶ added in v1.1.0
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CheckAndGet ¶ added in v1.1.0
CheckAndGet 检测并获取数据
func (*Client) CheckAndScan ¶ added in v1.1.0
CheckAndScan 获取数据
func (*Client) GetAndScan ¶ added in v1.1.0
GetAndScan 获取并扫描
func (*Client) HGetAndScan ¶ added in v1.1.0
HGetAndScan 获取Hash表指定字段的值
func (*Client) HKeysAndScan ¶ added in v1.1.0
HKeysAndScan 获取Hash表的所有键并扫描到dst中
func (*Client) HMGetAndScan ¶ added in v1.1.0
HMGetAndScan 获取Hash表指定字段的值并扫描进入到dst中
func (*Client) HValsAndScan ¶ added in v1.1.0
HValsAndScan 获取Hash表的所有值并扫如dst中
func (*Client) MGetAndScan ¶ added in v1.1.0
MGetAndScan 获取多个Keys的值并扫描进dst中
func (*Client) PopAndScan ¶ added in v1.1.0
PopAndScan 通过扫描方式取出列表内的第一个数据
func (*Client) RangAndScan ¶ added in v1.1.0
RangAndScan 通过扫描方式获取列表内的范围内数据
type HashClient ¶ added in v1.1.0
type HashClient struct {
// contains filtered or unexported fields
}
func NewHashClient ¶ added in v1.1.0
func NewHashClient(drivers ...driver.Hash) *HashClient
func (*HashClient) Del ¶ added in v1.1.0
func (cli *HashClient) Del(ctx context.Context, keys ...string) error
Del 删除键
func (*HashClient) HGetAndScan ¶ added in v1.1.0
HGetAndScan 获取Hash表指定字段的值
func (*HashClient) HKeysAndScan ¶ added in v1.1.0
HKeysAndScan 获取Hash表的所有键并扫描到dst中
func (*HashClient) HMGetAndScan ¶ added in v1.1.0
func (cli *HashClient) HMGetAndScan(ctx context.Context, dst any, key string, fields ...string) error
HMGetAndScan 获取Hash表指定字段的值并扫描进入到dst中
func (*HashClient) HValsAndScan ¶ added in v1.1.0
HValsAndScan 获取Hash表的所有值并扫如dst中
type ListClient ¶ added in v1.1.0
type ListClient struct {
// contains filtered or unexported fields
}
func NewListClient ¶ added in v1.1.0
func NewListClient(drivers ...driver.List) *ListClient
func (*ListClient) Del ¶ added in v1.1.0
func (cli *ListClient) Del(ctx context.Context, keys ...string) error
Del 删除键
func (*ListClient) PopAndScan ¶ added in v1.1.0
PopAndScan 通过扫描方式取出列表内的第一个数据
func (*ListClient) RangAndScan ¶ added in v1.1.0
func (cli *ListClient) RangAndScan(ctx context.Context, dst any, key string, start, stop int64) error
RangAndScan 通过扫描方式获取列表内的范围内数据
type StringClient ¶ added in v1.1.0
type StringClient struct {
// contains filtered or unexported fields
}
func NewStringClient ¶ added in v1.1.0
func NewStringClient(drivers ...driver.String) *StringClient
func (*StringClient) CheckAndGet ¶ added in v1.1.0
CheckAndGet 检测并获取数据
func (*StringClient) CheckAndScan ¶ added in v1.1.0
CheckAndScan 获取数据
func (*StringClient) Del ¶ added in v1.1.0
func (cli *StringClient) Del(ctx context.Context, keys ...string) error
Del 删除键
func (*StringClient) GetAndScan ¶ added in v1.1.0
GetAndScan 获取并扫描
func (*StringClient) MGetAndScan ¶ added in v1.1.0
MGetAndScan 获取多个Keys的值并扫描进dst中
Source Files
¶
Click to show internal directories.
Click to hide internal directories.
