Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CacheData ¶
type CacheData struct { ExpireAt int64 // ExpireAt is virtual expire time Data string // Data is cache data }
CacheData is cache data struct
type Cacher ¶
type Cacher interface { // GetData load data from cache // if cache not exist load data by LoadFunc // ttl is redis server ttl // virtualTTL is developer ttl GetData(ctx context.Context, key string, ttl time.Duration, virtualTTL time.Duration, f LoadFunc, data interface{}) (err error) // FlushCache flush cache // if cache not exist, load data and save cache FlushCache(ctx context.Context, key string, ttl time.Duration, virtualTTL time.Duration, f LoadFunc, data interface{}) (err error) }
Cacher is used to load cache
Click to show internal directories.
Click to hide internal directories.