Documentation ¶
Overview ¶
Cache package to provide an interface to interact with cache stores.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCacheIsDisabled = errors.New("cache is disabled") ErrRedisOptionsNil = errors.New("redis options is nil") )
Functions ¶
Types ¶
type BigCacheStore ¶
type BigCacheStore struct {
// contains filtered or unexported fields
}
type Cache ¶
type Cache struct { StoreType StoreType TTL time.Duration // contains filtered or unexported fields }
func NewBigCache ¶
Creates a new Cache using BigCache.
Requires a BigCache config that can be created with bigcache.DefaultConfig(n*time.Minute).
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
type Store ¶
type Store interface { // Returns an item from the cache. If no item is found, returns nil for the item and error. Get(ctx context.Context, key string) ([]byte, error) // Saves an item under the key provided. Set(ctx context.Context, key string, value []byte) error // Deletes an item from the cache. Delete(ctx context.Context, key string) error // Clears the entire cache. // // For Redis, the entire 'cache' namespace under 'equinox' is deleted. Clear(ctx context.Context) error }
Click to show internal directories.
Click to hide internal directories.