Documentation ¶
Overview ¶
Package rediscacheadapters contains the implementations of CacheAdapter and CacheSessionAdapter for Redis clusters, along with some helper methods to create instances.
More info on Redis at https://redis.io
Index ¶
- Variables
- func New(pool *redis.Pool, defaultTTL time.Duration) (cacheadapters.CacheAdapter, error)
- func NewSession(conn redis.Conn, defaultTTL time.Duration) (cacheadapters.CacheSessionAdapter, error)
- type RedisAdapter
- func (ra *RedisAdapter) Delete(key string) error
- func (ra *RedisAdapter) Get(key string, objectRef interface{}) error
- func (ra *RedisAdapter) OpenSession() (cacheadapters.CacheSessionAdapter, error)
- func (ra *RedisAdapter) Set(key string, object interface{}, TTL *time.Duration) error
- func (ra *RedisAdapter) SetTTL(key string, newTTL time.Duration) error
- type RedisCommandFunc
- type RedisSessionAdapter
- func (rsa *RedisSessionAdapter) Close() error
- func (rsa *RedisSessionAdapter) Delete(key string) error
- func (rsa *RedisSessionAdapter) Get(key string, objectRef interface{}) error
- func (rsa *RedisSessionAdapter) Set(key string, object interface{}, TTL *time.Duration) error
- func (rsa *RedisSessionAdapter) SetTTL(key string, newTTL time.Duration) error
Constants ¶
This section is empty.
Variables ¶
var ( //ErrInvalidConnection will come out if you try to use an invalid connection in a session. ErrInvalidConnection = fmt.Errorf("cannot use an invalid connection") )
Functions ¶
func New ¶
func New(pool *redis.Pool, defaultTTL time.Duration) (cacheadapters.CacheAdapter, error)
New creates a new RedisAdapter from an initialized Redis pool.
func NewSession ¶
func NewSession(conn redis.Conn, defaultTTL time.Duration) (cacheadapters.CacheSessionAdapter, error)
NewSession creates a new Redis Cache Session adapter from an existing Redis connection.
Types ¶
type RedisAdapter ¶
type RedisAdapter struct {
// contains filtered or unexported fields
}
RedisAdapter is the CacheAdapter implementation for Redis.
func (*RedisAdapter) Delete ¶ added in v0.0.2
func (ra *RedisAdapter) Delete(key string) error
Delete deletes a key from the cache.
func (*RedisAdapter) Get ¶
func (ra *RedisAdapter) Get(key string, objectRef interface{}) error
Get obtains a value from the cache using a key, then tries to unmarshal it into the object reference passed as parameter.
func (*RedisAdapter) OpenSession ¶
func (ra *RedisAdapter) OpenSession() (cacheadapters.CacheSessionAdapter, error)
OpenSession opens a new Cache Session.
type RedisCommandFunc ¶ added in v0.0.5
type RedisCommandFunc func(commandName string, args ...interface{})
type RedisSessionAdapter ¶
type RedisSessionAdapter struct {
// contains filtered or unexported fields
}
RedisSessionAdapter is the CacheSessionAdapter implementation for Redis.
func (*RedisSessionAdapter) Close ¶
func (rsa *RedisSessionAdapter) Close() error
Close closes the Cache Session.
func (*RedisSessionAdapter) Delete ¶ added in v0.0.2
func (rsa *RedisSessionAdapter) Delete(key string) error
Delete deletes a key from the cache.
func (*RedisSessionAdapter) Get ¶
func (rsa *RedisSessionAdapter) Get(key string, objectRef interface{}) error
Get obtains a value from the cache using a key, then tries to unmarshal it into the object reference passed as parameter.