Documentation
¶
Overview ¶
Package redis provides a Redis-backed implementation of store.Store.
It wraps redis.UniversalClient, which supports Redis standalone, Redis Cluster, and Redis Sentinel out of the box.
client := redis.NewClient(&redis.Options{Addr: "localhost:6379"})
s := redisstore.New(client)
// Or with Redis Cluster:
client := redis.NewClusterClient(&redis.ClusterOptions{
Addrs: []string{"node1:6379", "node2:6379", "node3:6379"},
})
s := redisstore.New(client)
Index ¶
- type Store
- func (s *Store) Client() goredis.UniversalClient
- func (s *Store) Close() error
- func (s *Store) Del(ctx context.Context, keys ...string) error
- func (s *Store) Eval(ctx context.Context, script string, keys []string, args ...interface{}) (interface{}, error)
- func (s *Store) EvalSha(ctx context.Context, sha1 string, keys []string, args ...interface{}) (interface{}, error)
- func (s *Store) Expire(ctx context.Context, key string, ttl time.Duration) error
- func (s *Store) Get(ctx context.Context, key string) (string, error)
- func (s *Store) HGetAll(ctx context.Context, key string) (map[string]string, error)
- func (s *Store) HSet(ctx context.Context, key string, values ...interface{}) error
- func (s *Store) IncrBy(ctx context.Context, key string, n int64) (int64, error)
- func (s *Store) Pipeline() store.Pipeline
- func (s *Store) ScriptLoad(ctx context.Context, script string) (string, error)
- func (s *Store) Set(ctx context.Context, key string, value string, ttl time.Duration) error
- func (s *Store) TTL(ctx context.Context, key string) (time.Duration, error)
- func (s *Store) ZAdd(ctx context.Context, key string, score float64, member string) error
- func (s *Store) ZCard(ctx context.Context, key string) (int64, error)
- func (s *Store) ZRangeWithScores(ctx context.Context, key string, start, stop int64) ([]store.ZEntry, error)
- func (s *Store) ZRemRangeByScore(ctx context.Context, key, min, max string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements store.Store backed by Redis.
func New ¶
func New(client goredis.UniversalClient) *Store
New creates a Redis-backed Store from any UniversalClient (standalone *redis.Client, *redis.ClusterClient, or *redis.Ring).
func (*Store) Client ¶
func (s *Store) Client() goredis.UniversalClient
Client returns the underlying Redis client.
func (*Store) ScriptLoad ¶
func (*Store) ZRangeWithScores ¶
Click to show internal directories.
Click to hide internal directories.