redis

package
v0.0.0-...-1cfe172 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2020 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() cache.Cacher

New create a cache instance of redis

Types

type Redis

type Redis struct {
	Name   string
	Prefix string
	// contains filtered or unexported fields
}

Redis implement a redis cache adapter for cacher

func (*Redis) Decr

func (c *Redis) Decr(key string) (int64, error)

Decr decreases cached int-type value by given key as a counter if key not exist, return errors

func (*Redis) Delete

func (c *Redis) Delete(key string) error

Delete delete cached data by given key

func (*Redis) Exist

func (c *Redis) Exist(key string) bool

Exist return true if value cached by given key

func (*Redis) Flush

func (c *Redis) Flush() error

Flush flush cacher

func (*Redis) Get

func (c *Redis) Get(key string, out interface{}) error

Get returns value by given key

func (*Redis) Incr

func (c *Redis) Incr(key string) (int64, error)

Incr increases cached int-type value by given key as a counter if key not exist, before increase set value with zero

func (*Redis) Set

func (c *Redis) Set(key string, v interface{}, ttl int64) error

Set cache value by given key, cache ttl second

func (*Redis) Start

func (c *Redis) Start(o cache.Options) error

Start new a cacher and start service

Jump to

Keyboard shortcuts

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