auburnredis

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2014 License: MIT, MIT Imports: 7 Imported by: 0

README

auburnredis

A helper library for redigo

redis cluster support

Minimal refactoring is necessary to gain cluster support:

  • Instantiate a auburnredis.Cluster object
  • Replace redis.Conn.Do/redis.Conn.Send with clusterobj.Do/clusterobj.Send
  • Then continue using the native redigo helper methods (String, Strings, Bytes, etc..)
  import(
    "github.com/garyburd/redigo/redis"
    "github.com/zerklabs/auburn/redis"
    "github.com/zerklabs/auburn/utils"
  )

  cluster := auburnredis.NewCluster("password", utils.DialEndpoint{Network:"tcp",Address:"127.0.0.1:7000"}, utils.DialEndpoint{Network:"tcp",Address:"127.0.0.1:7001"})
  resp, err := redis.String(cluster.Do("GET", "somekey"))
  if err != nil {
    panic(err)
  }

  println(resp)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RedisAddress  string
	RedisPassword string
)

Functions

func Fetch

func Fetch(c *Cluster, key string) ([]byte, error)

func NewPool

func NewPool(serverAddress, password string) *redis.Pool

func Pool

func Pool() *redis.Pool

func Purge

func Purge(c *Cluster, key string) error

func Store

func Store(c *Cluster, key string, value []byte, duration time.Duration) error

Types

type Cluster

type Cluster struct {
	Endpoints map[string]utils.DialEndpoint
	// contains filtered or unexported fields
}

func NewCluster

func NewCluster(password string, args ...interface{}) *Cluster

func (*Cluster) Do

func (c *Cluster) Do(cmd string, args ...interface{}) (interface{}, error)

func (*Cluster) HasMoved

func (c *Cluster) HasMoved(reply interface{}, err error) (bool, utils.DialEndpoint, interface{}, error)

func (*Cluster) SendHasMoved

func (c *Cluster) SendHasMoved(err error) (bool, utils.DialEndpoint, error)

Jump to

Keyboard shortcuts

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