Documentation
¶
Index ¶
- 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{}) (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 ¶
This section is empty.
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, targetRef interface{}) (interface{}, error)
Delete(ctx context.Context, key string) error
}
Cache interface specifies the methods of the cache system. Allows us to use either in-memory or Redis.
func NewInMemory ¶
func NewInMemory() Cache
type 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{}) (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.