Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hash ¶ added in v1.12.0
type Hash interface {
HGet(ctx context.Context, key, field string) (string, error)
HSet(ctx context.Context, key, field, value string) error
HDel(ctx context.Context, key, field string) error
HGetAll(ctx context.Context, key string) (map[string]string, error)
// HGetAllMulti pipelines multiple HGETALL commands in one round-trip.
// Returns one map per key in the same order; nil maps mean the key was empty/missing.
HGetAllMulti(ctx context.Context, keys []string) ([]map[string]string, error)
HIncrBy(ctx context.Context, key, field string, delta int64) (int64, error)
}
type JSON ¶ added in v1.12.0
type JSON interface {
SetJSON(ctx context.Context, key string, val interface{}) error
SetTimedJSON(ctx context.Context, key string, val interface{}, ttl int64, opts ...TimedOption) error
// SetTimedJSONNX marshals val and sets it only if the key does not already exist (SET NX).
// Returns true if the key was set, false if it already existed.
SetTimedJSONNX(ctx context.Context, key string, val interface{}, ttl int64, opts ...TimedOption) (bool, error)
GetJSON(ctx context.Context, key string, v interface{}) error
GetJSONWithTTL(ctx context.Context, key string, v interface{}) (LookupMeta, error)
// SetTimedJSONBatch pipelines multiple timed JSON SET commands in one round-trip.
// keys[i] is the Redis key for vals[i].
SetTimedJSONBatch(ctx context.Context, keys []string, vals []interface{}, ttl int64, opts ...TimedOption) error
}
type KV ¶ added in v1.12.0
type KV interface {
Set(ctx context.Context, key, val string) error
Get(ctx context.Context, key string) (string, error)
GetWithTTL(ctx context.Context, key string) (string, LookupMeta, error)
Delete(ctx context.Context, key string) error
GetBytes(ctx context.Context, key string) ([]byte, error)
SetTimed(ctx context.Context, key, val string, ttl int64) error
SetTimedInt64(ctx context.Context, key string, val int64, ttl int64) error
SetInt64(ctx context.Context, key string, val int64) error
SetTTL(ctx context.Context, key string, ttl int64) error
Incr(ctx context.Context, key string) (int64, error)
GetInt64(ctx context.Context, key string) (int64, error)
}
type LookupMeta ¶ added in v1.12.0
LookupMeta describes a cache lookup result.
type SortedSet ¶ added in v1.12.0
type SortedSet interface {
// ZAddBatch adds multiple members to a sorted set in a single ZADD command.
ZAddBatch(ctx context.Context, key string, members []ZBatchMember) error
ZAdd(ctx context.Context, key string, score float64, member string) error
ZRem(ctx context.Context, key string, members ...string) error
ZRevRangeByScore(ctx context.Context, key, max, min string, offset, count int64) ([]string, error)
}
type TimedOption ¶ added in v1.12.0
type TimedOption interface {
// contains filtered or unexported methods
}
func NoneProactive ¶ added in v1.12.0
func NoneProactive() TimedOption
type TimedOptions ¶ added in v1.12.0
type TimedOptions struct {
Proactive bool
}
func DefaultTimedOptions ¶ added in v1.12.0
func DefaultTimedOptions() TimedOptions
func ResolveTimedOptions ¶ added in v1.12.0
func ResolveTimedOptions(opts ...TimedOption) TimedOptions
type ZBatchMember ¶ added in v1.10.0
ZBatchMember is a (score, member) pair for ZAddBatch.
Click to show internal directories.
Click to hide internal directories.