redis

package
v0.0.0-...-f3ad2b4 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2015 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(conf Config) (*Redis, Error)

Types

type Config

type Config struct {
	// Redis network address, like localhost:6379
	Address string

	DialOptions []redis.DialOption

	// Prefix under which all keys will be stored.
	Prefix string

	// Maximum number of idle connections in the connection pool.
	MaxIdleConnections int

	// Timeout for idle connections in the pool in seconds.
	IdleConnectionTimeout int

	// Number of maximum active connections.
	MaxActiveConnections int

	// If true, wait until a connection becomes available instead of returning an
	// error.
	WaitForConnection bool

	// Password for redis authentication.
	Password string
}

type Redis

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

func (*Redis) Cleanup

func (r *Redis) Cleanup() Error

Clean up all expired entries.

func (*Redis) Clear

func (r *Redis) Clear() Error

Clear all items from the cache.

func (*Redis) ClearTag

func (r *Redis) ClearTag(tag string) Error

Clear all items with the specified tags.

func (*Redis) Delete

func (r *Redis) Delete(keys ...string) Error

Delete item from the cache.

func (*Redis) Get

func (r *Redis) Get(key string, items ...kit.CacheItem) (kit.CacheItem, Error)

Retrieve a cache item from the cache.

func (*Redis) GetString

func (r *Redis) GetString(key string) (string, Error)

func (*Redis) Keys

func (r *Redis) Keys() ([]string, Error)

func (*Redis) KeysByTags

func (r *Redis) KeysByTags(matchTags ...string) ([]string, Error)

func (*Redis) Name

func (r *Redis) Name() string

func (*Redis) Set

func (r *Redis) Set(item kit.CacheItem) Error

Save a new item into the cache.

func (*Redis) SetString

func (r *Redis) SetString(key string, value string, expiresAt *time.Time, tags []string) Error

Jump to

Keyboard shortcuts

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