Documentation ¶
Index ¶
Constants ¶
View Source
const ( DEFAULT = time.Duration(0) FOREVER = time.Duration(-1) )
Variables ¶
View Source
var ErrCacheMiss = errors.New("cache missing")
Functions ¶
This section is empty.
Types ¶
type MemoryStore ¶
func NewMemoryStore ¶
func NewMemoryStore(defaultExpiration, cleanupInterval time.Duration) *MemoryStore
func (*MemoryStore) Clear ¶
func (c *MemoryStore) Clear() error
func (*MemoryStore) Delete ¶
func (c *MemoryStore) Delete(key string) error
func (*MemoryStore) Get ¶
func (c *MemoryStore) Get(key string, ptr interface{}) error
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
func NewRedisStore ¶
func NewRedisStore(host, password string, defaultExpiration time.Duration) *RedisStore
func (*RedisStore) Clear ¶
func (c *RedisStore) Clear() error
func (*RedisStore) Delete ¶
func (c *RedisStore) Delete(key string) error
func (*RedisStore) Get ¶
func (c *RedisStore) Get(key string, ptr interface{}) error
type Store ¶
type Store interface { // Get retrieves item from cache, and return nil. // If the key is not found, return ErrCacheMiss. // Value must be a pointer. Get(key string, ptr interface{}) error // Set sets item to cache. // If the key exists, replace the item. Set(key string, value interface{}, expire time.Duration) error // Delete removes item from cache. // If the key does not exist, do nothing. Delete(key string) error // Clear all items from Clear() error }
Click to show internal directories.
Click to hide internal directories.