redis

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const NoExpiration time.Duration = -1

NoExpiration is used to indicate that data should not expire from the cache.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisConn

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

RedisConn represents a single connection to the redis pool.

func (*RedisConn) Close

func (c *RedisConn) Close()

Close returns the connection back to the pool for storage drivers that utilize a pool.

func (*RedisConn) Forget

func (c *RedisConn) Forget(key string) error

Forget clears the value from the cache for the particular key.

func (*RedisConn) ForgetAll

func (c *RedisConn) ForgetAll() error

ForgetAll clears all values from the cache.

func (*RedisConn) Get

func (c *RedisConn) Get(key string) (_ interface{}, found bool, _ error)

Get returns a value from the cache if the key exists.

func (*RedisConn) Set

func (c *RedisConn) Set(key string, expiration time.Duration, itemToStore interface{}) error

Set sets a item into the cache for a particular key.

func (*RedisConn) StorePointer

func (c *RedisConn) StorePointer() bool

StorePointer sets whether a storage driver requires itemToStore to be stored as a pointer or as a concrete value.

type RedisStore

type RedisStore struct {
	Pool *redis.Pool
}

RedisStore is used to create a redis-backed cache.

func NewRedisStore

func NewRedisStore(redisPool *redis.Pool) *RedisStore

NewRedisStore creates a redis-backed cache directly from a redis pool object.

func (*RedisStore) Conn

func (c *RedisStore) Conn(ctx context.Context) (remember.Cacher, error)

Conn will provide a single redis connection from the redis connection pool.

Jump to

Keyboard shortcuts

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