Documentation ¶
Index ¶
- Constants
- Variables
- func Initialize()
- type RedisCache
- func (c RedisCache) Add(key string, value interface{}, expires time.Duration) error
- func (c RedisCache) Decrement(key string, delta uint64) (newValue uint64, err error)
- func (c RedisCache) DecrementAuto(key string, delta uint64) (newValue uint64, err error)
- func (c RedisCache) Delete(key string) error
- func (c RedisCache) Flush() error
- func (c RedisCache) Get(key string, ptrValue interface{}) error
- func (c RedisCache) GetMulti(keys ...string) (cache.Getter, error)
- func (c RedisCache) Increment(key string, delta uint64) (uint64, error)
- func (c RedisCache) IncrementAuto(key string, delta uint64) (uint64, error)
- func (c RedisCache) Replace(key string, value interface{}, expires time.Duration) error
- func (c RedisCache) Set(key string, value interface{}, expires time.Duration) error
- type RedisItemMapGetter
Constants ¶
View Source
const ( DEFAULT = time.Duration(0) FOREVER = time.Duration(-1) )
Length of time to cache an item.
Variables ¶
View Source
var ( ErrCacheMiss = errors.New("cache: key not found.") ErrNotStored = errors.New("cache: not stored.") )
Functions ¶
func Initialize ¶
func Initialize()
Types ¶
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
Wraps the Redis client to meet the Cache interface.
func NewRedisCache ¶
func NewRedisCache(host string, password string, defaultExpiration time.Duration) RedisCache
until redigo supports sharding/clustering, only one host will be in hostList
func (RedisCache) Add ¶
func (c RedisCache) Add(key string, value interface{}, expires time.Duration) error
func (RedisCache) Decrement ¶
func (c RedisCache) Decrement(key string, delta uint64) (newValue uint64, err error)
func (RedisCache) DecrementAuto ¶
func (c RedisCache) DecrementAuto(key string, delta uint64) (newValue uint64, err error)
func (RedisCache) Delete ¶
func (c RedisCache) Delete(key string) error
func (RedisCache) Flush ¶
func (c RedisCache) Flush() error
func (RedisCache) Get ¶
func (c RedisCache) Get(key string, ptrValue interface{}) error
func (RedisCache) Increment ¶
func (c RedisCache) Increment(key string, delta uint64) (uint64, error)
func (RedisCache) IncrementAuto ¶
func (c RedisCache) IncrementAuto(key string, delta uint64) (uint64, error)
type RedisItemMapGetter ¶
Implement a Getter on top of the returned item map.
func (RedisItemMapGetter) Get ¶
func (g RedisItemMapGetter) Get(key string, ptrValue interface{}) error
Click to show internal directories.
Click to hide internal directories.