redis

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ACTION_SET redis set key value action
	ACTION_SET = "SET"
	// ACTION_GET redis get key value action
	ACTION_GET = "GET"
	// ACTION_DELETE redis delete key value action
	ACTION_DELETE = "DEL"
	// ACTION_RESET redis reset cache action
	ACTION_RESET = "FLUSHDB"
	// ACTION_PING redis ping action
	ACTION_PING = "PING"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisProvider

type RedisProvider struct {
	Addr      string
	MaxIdle   int
	MaxActive int
	// contains filtered or unexported fields
}

RedisProvider is a storage provider based on redis caching system

func NewRedisProvider

func NewRedisProvider(addr string, maxIdle int, maxActive int) (*RedisProvider, error)

NewRedisProvider returns a RedisProvider

func (*RedisProvider) Delete

func (redisProvider *RedisProvider) Delete(key string) error

Delete removes a value from the cache

func (*RedisProvider) Get

func (redisProvider *RedisProvider) Get(key string) ([]byte, error)

Get returns a cached value or error if it does not exist

func (*RedisProvider) HasKey

func (redisProvider *RedisProvider) HasKey(key string) bool

HasKey checks if the key exists

func (*RedisProvider) Init

func (redisProvider *RedisProvider) Init() error

Init initializes redis storage

func (*RedisProvider) Ping

func (redisProvider *RedisProvider) Ping() error

Ping checks redis connection

func (*RedisProvider) Reset

func (redisProvider *RedisProvider) Reset() error

Reset empties cache storage

func (*RedisProvider) Set

func (redisProvider *RedisProvider) Set(key string, value []byte) error

Set adds a new value to cache or updates if it already exists

Jump to

Keyboard shortcuts

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