redis

package
v0.0.0-...-9463477 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const PREFIX string = "r_cache:"

Default prefix to prevent collision with other key stored in redis

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

func NewRedisCache

func NewRedisCache(opts *redis.Options, prefix string) *Cache

func (*Cache) ClearAll

func (r *Cache) ClearAll() error

ClearAll clean all cache in redis.

func (*Cache) Delete

func (r *Cache) Delete(key string) error

Delete delete cache in redis.

func (*Cache) Get

func (r *Cache) Get(key string) ([]byte, error)

Get cache from redis

func (*Cache) IsExist

func (r *Cache) IsExist(key string) bool

IsExist check cache's existence in redis.

func (*Cache) Put

func (r *Cache) Put(key string, data []byte, expire time.Duration) error

Put put cache to redis.

Jump to

Keyboard shortcuts

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