Documentation ¶
Index ¶
- type Connection
- func (conn Connection) Close() error
- func (conn Connection) DeleteCache(key string) error
- func (conn Connection) DeleteCacheContext(c context.Context, key string) error
- func (conn Connection) Exists(key string) bool
- func (conn Connection) ExistsContext(c context.Context, key string) bool
- func (conn Connection) GetCache(key string, val interface{}) error
- func (conn Connection) GetCacheContext(c context.Context, key string, val interface{}) error
- func (conn Connection) SetCache(key string, val interface{}, override bool) error
- func (conn Connection) SetCacheContext(c context.Context, key string, val interface{}, override bool) error
- func (conn Connection) SetCacheTTLContext(c context.Context, key string, val interface{}, override bool, ...) error
- type Options
- func (o *Options) SetAddr(addr string) *Options
- func (o *Options) SetConnectCallback(connectCallback func(ctx context.Context, cn *redis.Conn) error) *Options
- func (o *Options) SetDB(db int) *Options
- func (o *Options) SetDialTimeout(dialTimeout time.Duration) *Options
- func (o *Options) SetIdleTimeout(idleTimeout time.Duration) *Options
- func (o *Options) SetMaxRetries(maxRetries int) *Options
- func (o *Options) SetPassword(password string) *Options
- func (o *Options) SetPoolFIFO(poolFIFO bool) *Options
- func (o *Options) SetPoolTimeout(poolTimeout time.Duration) *Options
- func (o *Options) SetReadTimeout(readTimeout time.Duration) *Options
- func (o *Options) SetTLSConfig(tlsConfig *tls.Config) *Options
- func (o *Options) SetUsername(username string) *Options
- func (o *Options) SetWriteTimeout(writeTimeout time.Duration) *Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct { Client *redis.Client Cache *cache.Cache }
func (Connection) DeleteCache ¶
func (conn Connection) DeleteCache(key string) error
DeleteCache deletes a redis item
func (Connection) DeleteCacheContext ¶
func (conn Connection) DeleteCacheContext(c context.Context, key string) error
DeleteCacheContext deletes a redis item with context
func (Connection) Exists ¶
func (conn Connection) Exists(key string) bool
Exists checks if a key exists
func (Connection) ExistsContext ¶
func (conn Connection) ExistsContext(c context.Context, key string) bool
ExistsContext checks if a key exists with context
func (Connection) GetCache ¶
func (conn Connection) GetCache(key string, val interface{}) error
GetCache gets a redis item
func (Connection) GetCacheContext ¶
func (conn Connection) GetCacheContext(c context.Context, key string, val interface{}) error
GetCacheContext gets a redis item with context
func (Connection) SetCache ¶
func (conn Connection) SetCache(key string, val interface{}, override bool) error
SetCache sets a redis with one hour TTL
func (Connection) SetCacheContext ¶
func (conn Connection) SetCacheContext(c context.Context, key string, val interface{}, override bool) error
SetCacheContext sets a redis with one hour TTL with context
func (Connection) SetCacheTTLContext ¶
func (conn Connection) SetCacheTTLContext(c context.Context, key string, val interface{}, override bool, ttl time.Duration) error
SetCacheTTLContext sets a redis with a TTL
type Options ¶
type Options struct { Addr string Username string Password string DB int MaxRetries int DialTimeout time.Duration ReadTimeout time.Duration WriteTimeout time.Duration PoolTimeout time.Duration IdleTimeout time.Duration PoolFIFO bool TLSConfig *tls.Config ConnectCallback func(ctx context.Context, cn *redis.Conn) error }
func NewOptions ¶
func NewOptions() *Options
func (*Options) SetConnectCallback ¶
func (*Options) SetDialTimeout ¶
func (*Options) SetIdleTimeout ¶
func (*Options) SetMaxRetries ¶
func (*Options) SetPassword ¶
func (*Options) SetPoolFIFO ¶
func (*Options) SetPoolTimeout ¶
func (*Options) SetReadTimeout ¶
func (*Options) SetUsername ¶
Click to show internal directories.
Click to hide internal directories.