Documentation ¶
Overview ¶
Package redis is a facade in front of github.com/go-redis/redis/v8
Index ¶
- Variables
- type Cache
- 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) GetString(r metrics.Recorder, key 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)
- type Noop
- func (n *Noop) Delete(metrics.Recorder, string) error
- func (n *Noop) ForeverTTL() int
- func (n *Noop) Get(metrics.Recorder, string) (interface{}, error)
- func (n *Noop) GetHashSet(metrics.Recorder, []string) ([]map[string]string, error)
- func (n *Noop) GetString(metrics.Recorder, string) (string, error)
- func (n *Noop) IncrementHash(metrics.Recorder, string, string, int) error
- func (n *Noop) IncrementHashWithDuration(metrics.Recorder, string, string, int, time.Duration) error
- func (n *Noop) Ping(metrics.Recorder) error
- func (n *Noop) Set(metrics.Recorder, string, interface{}) error
- func (n *Noop) SetWithDuration(metrics.Recorder, string, interface{}, time.Duration) error
- func (n *Noop) TTL(metrics.Recorder, 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 Cache ¶ added in v1.1.16
type Cache interface { ForeverTTL() int Ping(metrics.Recorder) error GetString(metrics.Recorder, string) (string, error) Get(metrics.Recorder, string) (interface{}, error) TTL(metrics.Recorder, string) (time.Duration, error) Set(metrics.Recorder, string, interface{}) error SetWithDuration(metrics.Recorder, string, interface{}, time.Duration) error Delete(metrics.Recorder, string) error IncrementHash(metrics.Recorder, string, string, int) error IncrementHashWithDuration(metrics.Recorder, string, string, int, time.Duration) error GetHashSet(metrics.Recorder, []string) ([]map[string]string, error) }
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.
type Noop ¶ added in v1.1.16
type Noop struct{}
Noop allows us to have a passthrough, do nothing cache.