Documentation ¶
Overview ¶
Package redis is a facade in front of github.com/go-redis/redis/v8
Index ¶
- Variables
- type Client
- func (c *Client) Delete(r metrics.Recorder, key string) error
- func (c *Client) ForeverTTL() int
- func (c *Client) Get(r metrics.Recorder, key string) (interface{}, error)
- func (c *Client) GetHashSet(r metrics.Recorder, keys []string) ([]map[string]string, error)
- func (c *Client) IncrementHash(r metrics.Recorder, key, field string, amount int) error
- func (c *Client) IncrementHashWithDuration(r metrics.Recorder, key, field string, amount int, ttl time.Duration) error
- func (c *Client) Ping(r metrics.Recorder) error
- func (c *Client) Set(r metrics.Recorder, key string, value interface{}) error
- func (c *Client) SetWithDuration(r metrics.Recorder, key string, value interface{}, ttl time.Duration) error
- func (c *Client) TTL(r metrics.Recorder, key string) (time.Duration, error)
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultTTL defines a default TTL value for all keys. DefaultTTL time.Duration // Namespace allows for a custom Namespace to be added to all keys. Namespace = "" // ErrNotFound is returned when no data was found ErrNotFound = errors.New("not found") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { RDB *redis.Client // contains filtered or unexported fields }
Client provides interaction with redis.
func (*Client) ForeverTTL ¶ added in v1.0.64
ForeverTTL returns the redis value that represents the no-expire TTL value.
func (*Client) GetHashSet ¶
GetHashSet uses a redis pipe to retrieve a number of hashes and return an aggregate of their responses.
func (*Client) IncrementHash ¶
IncrementHash increments a value at a give key/field location. Hash will live for the standard ttl duration.
func (*Client) IncrementHashWithDuration ¶
func (c *Client) IncrementHashWithDuration(r metrics.Recorder, key, field string, amount int, ttl time.Duration) error
IncrementHashWithDuration increments a value at a give key/field location.
We can only expire the entire hash. We set a TTL via Expire once only if the hash key has not previously existed. We make the assumption that if it already exists, it's already had an Expire set.