Versions in this module Expand all Collapse all v4 v4.4.0 Jun 25, 2020 Changes in this version + var ErrCacheMiss = errors.New("cache: miss") + var ErrNotStored = errors.New("cache: not stored") + var Null = &nullCache + func Add(ctx context.Context, key string, value interface{}, expire time.Duration) error + func Dec(ctx context.Context, key string, value uint64) (int64, error) + func Delete(ctx context.Context, key string) error + func Inc(ctx context.Context, key string, value uint64) (int64, error) + func Replace(ctx context.Context, key string, value interface{}, expire time.Duration) error + func Set(ctx context.Context, key string, value interface{}, expire time.Duration) error + func WithCache(ctx context.Context, cache Cache) context.Context + type Cache interface + Add func(key string, value interface{}, expire time.Duration) error + Dec func(key string, value uint64) (int64, error) + Delete func(key string) error + Get func(key string) *Item + GetMulti func(keys ...string) ([]*Item, error) + Inc func(key string, value uint64) (int64, error) + Replace func(key string, value interface{}, expire time.Duration) error + Set func(key string, value interface{}, expire time.Duration) error + func FromContext(ctx context.Context) (Cache, bool) + func NewMemcache(uri string, opts ...MemcacheOptionsFunc) Cache + func NewRedis(uri string, opts ...RedisOptionsFunc) (Cache, error) + func NewRedisUniversal(addrs []string, opts ...RedisOptionsFunc) (Cache, error) + type Item struct + func Get(ctx context.Context, key string) *Item + func GetMulti(ctx context.Context, keys ...string) ([]*Item, error) + func (i Item) Bool() (bool, error) + func (i Item) Bytes() ([]byte, error) + func (i Item) Err() error + func (i Item) Float64() (float64, error) + func (i Item) Int64() (int64, error) + func (i Item) String() (string, error) + func (i Item) Uint64() (uint64, error) + type MemcacheOptionsFunc func(*memcache.Client) + func WithIdleConns(size int) MemcacheOptionsFunc + func WithTimeout(timeout time.Duration) MemcacheOptionsFunc + type RedisOptionsFunc func(*redis.UniversalOptions) + func WithPoolSize(size int) RedisOptionsFunc + func WithPoolTimeout(timeout time.Duration) RedisOptionsFunc + func WithReadTimeout(timeout time.Duration) RedisOptionsFunc + func WithWriteTimeout(timeout time.Duration) RedisOptionsFunc Other modules containing this package github.com/msales/pkg github.com/msales/pkg/v3