Documentation
¶
Index ¶
- Variables
- type Client
- func (r *Client) Del(keys ...string) error
- func (r *Client) Exists(keys ...string) (bool, error)
- func (r *Client) Expire(key string, duration time.Duration) error
- func (r *Client) Get(key string) (string, error)
- func (r *Client) Keys(pattern string) ([]string, error)
- func (r *Client) Set(key string, value string, duration time.Duration) error
- type Interface
- type Options
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoSuchKey = errors.New("no such key")
View Source
var NeverExpire = time.Duration(0)
Functions ¶
This section is empty.
Types ¶
type Interface ¶
type Interface interface {
// Keys retrieves all keys match the given pattern
Keys(pattern string) ([]string, error)
// Get retrieves the value of the given key, return error if key doesn't exist
Get(key string) (string, error)
// Set sets the value and living duration of the given key, zero duration means never expire
Set(key string, value string, duration time.Duration) error
// Del deletes the given key, no error returned if the key doesn't exists
Del(keys ...string) error
// Exists checks the existence of a give key
Exists(keys ...string) (bool, error)
// Expires updates object's expiration time, return err if key doesn't exist
Expire(key string, duration time.Duration) error
}
func NewRedisClient ¶
func NewSimpleCache ¶
func NewSimpleCache() Interface
type Options ¶
type Options struct {
Host string `json:"host"`
Port int `json:"port"`
Password string `json:"password"`
DB int `json:"db"`
}
func NewRedisOptions ¶
func NewRedisOptions() *Options
NewRedisOptions returns options points to nowhere, because redis is not required for some components
Click to show internal directories.
Click to hide internal directories.