Versions in this module Expand all Collapse all v0 v0.0.1 Jan 30, 2018 v0.0.0 Jul 23, 2017 Changes in this version + const DEFAULT + const FOREVER + var CachePrefix = "default" + var ErrCacheMiss = errors.New("cache: key not found.") + var ErrNotStored = errors.New("cache: not stored.") + var ErrNotSupport = errors.New("cache: not support.") + type CacheStore interface + Add func(key string, value interface{}, expire time.Duration) error + Decrement func(key string, data uint64) (uint64, error) + Delete func(key string) error + Flush func() error + Get func(key string, value interface{}) error + Increment func(key string, data uint64) (uint64, error) + Replace func(key string, data interface{}, expire time.Duration) error + Set func(key string, value interface{}, expire time.Duration) error + type InMemoryStore struct + func NewInMemoryStore(defaultExpiration time.Duration) *InMemoryStore + func (c *InMemoryStore) Add(key string, value interface{}, expires time.Duration) error + func (c *InMemoryStore) Decrement(key string, n uint64) (uint64, error) + func (c *InMemoryStore) Delete(key string) error + func (c *InMemoryStore) Flush() error + func (c *InMemoryStore) Get(key string, value interface{}) error + func (c *InMemoryStore) Increment(key string, n uint64) (uint64, error) + func (c *InMemoryStore) Replace(key string, value interface{}, expires time.Duration) error + func (c *InMemoryStore) Set(key string, value interface{}, expires time.Duration) error + type MemcachedStore struct + func NewMemcachedStore(hostList []string, defaultExpiration time.Duration) *MemcachedStore + func (c *MemcachedStore) Add(key string, value interface{}, expires time.Duration) error + func (c *MemcachedStore) Decrement(key string, delta uint64) (uint64, error) + func (c *MemcachedStore) Delete(key string) error + func (c *MemcachedStore) Flush() error + func (c *MemcachedStore) Get(key string, value interface{}) error + func (c *MemcachedStore) Increment(key string, delta uint64) (uint64, error) + func (c *MemcachedStore) Replace(key string, value interface{}, expires time.Duration) error + func (c *MemcachedStore) Set(key string, value interface{}, expires time.Duration) error + type RedisStore struct + func NewRedisCache(host string, password string, defaultExpiration time.Duration) *RedisStore + func (c *RedisStore) Add(key string, value interface{}, expires time.Duration) error + func (c *RedisStore) Decrement(key string, delta uint64) (newValue uint64, err error) + func (c *RedisStore) Delete(key string) error + func (c *RedisStore) Flush() error + func (c *RedisStore) Get(key string, ptrValue interface{}) error + func (c *RedisStore) Increment(key string, delta uint64) (uint64, error) + func (c *RedisStore) Replace(key string, value interface{}, expires time.Duration) error + func (c *RedisStore) Set(key string, value interface{}, expires time.Duration) error