Documentation
¶
Index ¶
- func KeyNotFound(err error) bool
- type Cache
- type Connection
- func (c *Connection) Delete(ctx context.Context, key string) error
- func (c *Connection) Get(ctx context.Context, key string) (string, error)
- func (c *Connection) GetStruct(ctx context.Context, key string, target interface{}) error
- func (connection *Connection) Ping(ctx context.Context) error
- func (c *Connection) Set(ctx context.Context, key string, value string, expiration time.Duration) error
- func (c *Connection) SetStruct(ctx context.Context, key string, value interface{}, expiration time.Duration) error
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func KeyNotFound ¶
KeyNotFound will detect whether error signifies key not found by Redis.
Types ¶
type Cache ¶
type Cache interface {
Set(ctx context.Context, key string, value string, expiration time.Duration) error
Get(ctx context.Context, key string) (string, error)
SetStruct(ctx context.Context, key string, value interface{}, expiration time.Duration) error
GetStruct(ctx context.Context, key string, target interface{}) error
Delete(ctx context.Context, key string) error
}
Cache interface specifies the methods implemented for Redis caching. String key and interface{} value are the supported types.
type Connection ¶
func NewClient ¶
func NewClient(options Options) *Connection
func (*Connection) Delete ¶
func (c *Connection) Delete(ctx context.Context, key string) error
Delete executes the redis Del command
func (*Connection) GetStruct ¶
func (c *Connection) GetStruct(ctx context.Context, key string, target interface{}) error
GetStruct executes the redis Get command
func (*Connection) Ping ¶
func (connection *Connection) Ping(ctx context.Context) error
Ping tests connectivity for redis (PONG should be returned)
Click to show internal directories.
Click to hide internal directories.