redis

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2019 License: Unlicense Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT = time.Duration(0)
	FOREVER = time.Duration(-1)
)

Length of time to cache an item.

Variables

View Source
var (
	ErrCacheMiss = errors.New("cache: key not found.")
	ErrNotStored = errors.New("cache: not stored.")
)

Functions

func Initialize

func Initialize()

Types

type RedisCache

type RedisCache struct {
	// contains filtered or unexported fields
}

Wraps the Redis client to meet the Cache interface.

func NewRedisCache

func NewRedisCache(host string, password string, defaultExpiration time.Duration) RedisCache

until redigo supports sharding/clustering, only one host will be in hostList

func (RedisCache) Add

func (c RedisCache) Add(key string, value interface{}, expires time.Duration) error

func (RedisCache) Decrement

func (c RedisCache) Decrement(key string, delta uint64) (newValue uint64, err error)

func (RedisCache) DecrementAuto

func (c RedisCache) DecrementAuto(key string, delta uint64) (newValue uint64, err error)

func (RedisCache) Delete

func (c RedisCache) Delete(key string) error

func (RedisCache) Flush

func (c RedisCache) Flush() error

func (RedisCache) Get

func (c RedisCache) Get(key string, ptrValue interface{}) error

func (RedisCache) GetMulti

func (c RedisCache) GetMulti(keys ...string) (cache.Getter, error)

func (RedisCache) Increment

func (c RedisCache) Increment(key string, delta uint64) (uint64, error)

func (RedisCache) IncrementAuto

func (c RedisCache) IncrementAuto(key string, delta uint64) (uint64, error)

func (RedisCache) Replace

func (c RedisCache) Replace(key string, value interface{}, expires time.Duration) error

func (RedisCache) Set

func (c RedisCache) Set(key string, value interface{}, expires time.Duration) error

type RedisItemMapGetter

type RedisItemMapGetter map[string][]byte

Implement a Getter on top of the returned item map.

func (RedisItemMapGetter) Get

func (g RedisItemMapGetter) Get(key string, ptrValue interface{}) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL