Documentation ¶
Overview ¶
Package cache implement a simple cache redis client. It define a type [Cache] that represent the cache client and It define the methods Get to get a valur from a cache key.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCacheNotEnabled = errors.New("CACHE NOT ENABLED")
Functions ¶
This section is empty.
Types ¶
type CacheClient ¶
type CacheClient struct { Client *redis.Client Enabled bool // contains filtered or unexported fields }
CacheClient redis cache client.
func NewCacheClient ¶
func NewCacheClient(url string, enabled bool, log *zap.Logger) *CacheClient
NewCacheClient init a new cache client.
func (*CacheClient) Get ¶
Get get a cache value or error from a key. If the cache is not enabled, the error value If the cache not contain a value from a key, the error value errors.ErrNotFound is returned. If exist some internal error in the cache, the error value errros.ErrInternalError is returned.
type DummyCacheClient ¶
type DummyCacheClient struct { }
DummyCacheClient dummy cache client.
func NewDummyCacheClient ¶
func NewDummyCacheClient() DummyCacheClient
NewDummyCacheClient create a new instance of DummyCacheClient
Click to show internal directories.
Click to hide internal directories.