redis

package
v0.0.0-...-fb7d9fd Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2019 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(pool *redis.Pool, key string) error

Delete deletes the entry for key

func FromRedis

func FromRedis(reply, value interface{}, bad error) (err error)

FromRedis converts a binary value returned from redis to its native type

func Get

func Get(pool *redis.Pool, key string) (interface{}, error)

Get gets the value of key

func GetAll

func GetAll(pool *redis.Pool) (interface{}, error)

GetAll gets all keys

func GetPoolForService

func GetPoolForService(a ...string) *redis.Pool

GetPoolForService creates a Redigo Pool to connect to Redis service given

the bound service name.

func Set

func Set(pool *redis.Pool, key string, value interface{}) error

Set gets a key to the value

func SetWithExpire

func SetWithExpire(pool *redis.Pool, key string, value interface{}, expire int64) error

SetWithExpire gets a key to the value with an expiration period

func ToRedis

func ToRedis(value interface{}) interface{}

ToRedis converts a value to be written to redis

Types

type RedisClient

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

RedisClient is the redis client

func NewRedisClient

func NewRedisClient(name ...string) *RedisClient

NewRedisClient returns a redis client

func (*RedisClient) Credentials

func (r *RedisClient) Credentials() string

func (*RedisClient) Delete

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

Delete deletes the key and its value

func (*RedisClient) Do

func (r *RedisClient) Do(cmd string, args ...interface{}) (interface{}, error)

Do is a generic redis command function

func (*RedisClient) Get

func (r *RedisClient) Get(key string, value interface{}) error

Get returns the value for key

func (*RedisClient) GetAllKeys

func (r *RedisClient) GetAllKeys() ([]string, error)

GetAllKeys returns all keys

func (*RedisClient) GetKeys

func (r *RedisClient) GetKeys(matching ...string) ([]string, error)

GetKeys gets the keys matching the given regexps (if any)

func (*RedisClient) GetKeysWithPrefix

func (r *RedisClient) GetKeysWithPrefix(matching ...string) ([]string, error)

GetKeysWithPrefix gets the keys matching the given prefixes

func (*RedisClient) HDel

func (r *RedisClient) HDel(hash string, fields ...string) error

HDel deletes the key(s) of a hash

func (*RedisClient) HGet

func (r *RedisClient) HGet(hash, field string, value interface{}) error

HGet gets a hash value

func (*RedisClient) HKeys

func (r *RedisClient) HKeys(hash string) ([]string, error)

HKeys gets the keys of a hash

func (*RedisClient) HSet

func (r *RedisClient) HSet(hash, field string, value interface{}) (bool, error)

HSet sets a hash value returns true if new value

func (*RedisClient) HVals

func (r *RedisClient) HVals(hash string, save func([]uint8) error) error

HVals gets all values of a hash

func (*RedisClient) Info

func (r *RedisClient) Info() (string, error)

Info returns server information

func (*RedisClient) MGet

func (r *RedisClient) MGet(keys ...string) ([]interface{}, error)

MGet gets the values for the given keys

func (*RedisClient) Set

func (r *RedisClient) Set(key string, value interface{}) error

Set applies the value to key

func (*RedisClient) SetWithExpire

func (r *RedisClient) SetWithExpire(key string, value interface{}, expire int64) error

SetWithExpire applies the value to key with an expiration

Jump to

Keyboard shortcuts

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