redisc

package module
v0.0.0-...-7d7b0cc Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2015 License: MIT Imports: 8 Imported by: 0

README

redisc

Redis Client

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayOfBytes

func ArrayOfBytes(results interface{}, err error) ([][]byte, error)

func ArrayOfInts

func ArrayOfInts(results interface{}, err error) ([]int, error)

func ArrayOfStrings

func ArrayOfStrings(results interface{}, err error) ([]string, error)

func GetMembers

func GetMembers(members []*ScoredMember) []string

func Prefix

func Prefix(namespace string, keys []string) []string

func ReadWriteHosts

func ReadWriteHosts(hosts []*RedisHosts) (read []string, write []string)

func StringsToInterfaces

func StringsToInterfaces(keys []string) []interface{}

Types

type Client

type Client interface {
	Write(command string, args ...interface{}) (interface{}, error)
	Read(command string, args ...interface{}) (interface{}, error)
	ReadInt64(command string, args ...interface{}) (int64, error)
}

type KeyValueString

type KeyValueString struct {
	Key   string
	Value string
}

type RedisCache

type RedisCache struct {
	Log     logging.Logger `inject:""`
	Encoder func(v interface{}) ([]byte, error)
	Decoder func(data []byte, v interface{}) error
	// contains filtered or unexported fields
}

func NewService

func NewService(readUris []string, writeUris []string, hostPassword string) (*RedisCache, error)

NewRedisCache creates a new cache service connecting to the given hostUris and hostPassword. If there is no hostPassword, then pass an empty string.

func (*RedisCache) GetBytes

func (r *RedisCache) GetBytes(key string) (result []byte, err error)

func (*RedisCache) GetHashInt64

func (r *RedisCache) GetHashInt64(hashName string) (map[string]int64, error)

func (*RedisCache) GetObject

func (r *RedisCache) GetObject(key string, instance interface{}) (miss bool, err error)

func (*RedisCache) Increment

func (r *RedisCache) Increment(hashName, fieldName string, by int) (int64, error)

func (*RedisCache) Ping

func (r *RedisCache) Ping() error

func (*RedisCache) Read

func (r *RedisCache) Read(command string, args ...interface{}) (interface{}, error)

func (*RedisCache) ReadInt64

func (r *RedisCache) ReadInt64(command string, args ...interface{}) (int64, error)

func (*RedisCache) SetBytes

func (r *RedisCache) SetBytes(key string, bytes []byte) error

func (*RedisCache) Write

func (r *RedisCache) Write(command string, args ...interface{}) (interface{}, error)

type RedisHosts

type RedisHosts struct {
	Host    string `json:"host"`
	Primary bool   `json:"primary"`
}

type ScoredMember

type ScoredMember struct {
	Score  int
	Member string
}

Jump to

Keyboard shortcuts

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