Documentation ¶
Index ¶
- type Cache
- type RedisCache
- func (r *RedisCache) Delete(key string) error
- func (r *RedisCache) DeleteMask(mask string) error
- func (r *RedisCache) DeleteMulti(keys ...interface{}) error
- func (r *RedisCache) Exists(key string) (bool, error)
- func (r *RedisCache) Get(key string, pointer interface{}) error
- func (r *RedisCache) Set(key string, value interface{}, expires time.Duration) error
- type RedisCacheOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { Get(key string, pointer interface{}) error Set(key string, value interface{}, expires time.Duration) error Delete(key string) error DeleteMask(mask string) error DeleteMulti(keys ...interface{}) error Exists(key string) (bool, error) }
Cache is the basic interface for cache implementations
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
RedisCache is an implementation of Cache that uses Redis as a backend
func NewRedisCache ¶
func NewRedisCache(options *RedisCacheOpts) (*RedisCache, error)
NewRedisCache creates a new cache with a redis backend
func (*RedisCache) Delete ¶
func (r *RedisCache) Delete(key string) error
Delete removes data in redis by key
func (*RedisCache) DeleteMask ¶
func (r *RedisCache) DeleteMask(mask string) error
DeleteMask removes data using KEYS masks
func (*RedisCache) DeleteMulti ¶
func (r *RedisCache) DeleteMulti(keys ...interface{}) error
DeleteMulti removes multiple keys
func (*RedisCache) Exists ¶
func (r *RedisCache) Exists(key string) (bool, error)
Exists performs a check whether a key exists
func (*RedisCache) Get ¶
func (r *RedisCache) Get(key string, pointer interface{}) error
Get retrieves data from the database and then decodes it into the passed pointer.
Click to show internal directories.
Click to hide internal directories.