redis.v5: gopkg.in/redis.v5 Index | Examples | Files | Directories

package redis

import "gopkg.in/redis.v5"

Package redis implements a Redis client.

Code:

Get := func(client *redis.Client, key string) *redis.StringCmd {
    cmd := redis.NewStringCmd("GET", key)
    client.Process(cmd)
    return cmd
}

v, err := Get(client, "key_does_not_exist").Result()
fmt.Printf("%q %s", v, err)

Output:

"" redis: nil

Code:

package main

import (
    "fmt"
    "sync/atomic"
    "time"

    redis "gopkg.in/redis.v5"
)

func main() {
    ring := redis.NewRing(&redis.RingOptions{
        Addrs: map[string]string{
            "shard1": ":6379",
        },
    })
    ring.ForEachShard(func(client *redis.Client) error {
        wrapRedisProcess(client)
        return nil
    })

    for {
        ring.Ping()
    }
}

func wrapRedisProcess(client *redis.Client) {
    const precision = time.Microsecond
    var count, avgDur uint32

    go func() {
        for _ = range time.Tick(3 * time.Second) {
            n := atomic.LoadUint32(&count)
            dur := time.Duration(atomic.LoadUint32(&avgDur)) * precision
            fmt.Printf("%s: processed=%d avg_dur=%s\n", client, n, dur)
        }
    }()

    client.WrapProcess(func(oldProcess func(redis.Cmder) error) func(redis.Cmder) error {
        return func(cmd redis.Cmder) error {
            start := time.Now()
            err := oldProcess(cmd)
            dur := time.Since(start)

            const decay = float64(1) / 100
            ms := float64(dur / precision)
            for {
                avg := atomic.LoadUint32(&avgDur)
                newAvg := uint32((1-decay)*float64(avg) + decay*ms)
                if atomic.CompareAndSwapUint32(&avgDur, avg, newAvg) {
                    break
                }
            }
            atomic.AddUint32(&count, 1)

            return err
        }
    })
}

Index

Examples

Package Files

cluster.go command.go commands.go doc.go iterator.go options.go parser.go pipeline.go pubsub.go redis.go redis_context.go result.go ring.go script.go sentinel.go tx.go

Constants

const Nil = internal.Nil

Redis nil reply, .e.g. when key does not exist.

const TxFailedErr = internal.RedisError("redis: transaction failed")

Redis transaction failed.

func SetLogger Uses

func SetLogger(logger *log.Logger)

type BitCount Uses

type BitCount struct {
    Start, End int64
}

type BoolCmd Uses

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

func NewBoolCmd Uses

func NewBoolCmd(args ...interface{}) *BoolCmd

func NewBoolResult Uses

func NewBoolResult(val bool, err error) *BoolCmd

NewBoolResult returns a BoolCmd initalised with val and err for testing

func (*BoolCmd) Err Uses

func (cmd *BoolCmd) Err() error

func (*BoolCmd) Result Uses

func (cmd *BoolCmd) Result() (bool, error)

func (*BoolCmd) String Uses

func (cmd *BoolCmd) String() string

func (*BoolCmd) Val Uses

func (cmd *BoolCmd) Val() bool

type BoolSliceCmd Uses

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

func NewBoolSliceCmd Uses

func NewBoolSliceCmd(args ...interface{}) *BoolSliceCmd

func NewBoolSliceResult Uses

func NewBoolSliceResult(val []bool, err error) *BoolSliceCmd

NewBoolSliceResult returns a BoolSliceCmd initalised with val and err for testing

func (*BoolSliceCmd) Err Uses

func (cmd *BoolSliceCmd) Err() error

func (*BoolSliceCmd) Result Uses

func (cmd *BoolSliceCmd) Result() ([]bool, error)

func (*BoolSliceCmd) String Uses

func (cmd *BoolSliceCmd) String() string

func (*BoolSliceCmd) Val Uses

func (cmd *BoolSliceCmd) Val() []bool

type Client Uses

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

Client is a Redis client representing a pool of zero or more underlying connections. It's safe for concurrent use by multiple goroutines.

Code:

err := client.Set("key", "value", 0).Err()
if err != nil {
    panic(err)
}

val, err := client.Get("key").Result()
if err != nil {
    panic(err)
}
fmt.Println("key", val)

val2, err := client.Get("key2").Result()
if err == redis.Nil {
    fmt.Println("key2 does not exists")
} else if err != nil {
    panic(err)
} else {
    fmt.Println("key2", val2)
}

Output:

key value
key2 does not exists

func NewClient Uses

func NewClient(opt *Options) *Client

NewClient returns a client to the Redis Server specified by Options.

Code:

client := redis.NewClient(&redis.Options{
    Addr:     "localhost:6379",
    Password: "", // no password set
    DB:       0,  // use default DB
})

pong, err := client.Ping().Result()
fmt.Println(pong, err)

Output:

PONG <nil>

func NewFailoverClient Uses

func NewFailoverClient(failoverOpt *FailoverOptions) *Client

NewFailoverClient returns a Redis client that uses Redis Sentinel for automatic failover. It's safe for concurrent use by multiple goroutines.

Code:

// See http://redis.io/topics/sentinel for instructions how to
// setup Redis Sentinel.
client := redis.NewFailoverClient(&redis.FailoverOptions{
    MasterName:    "master",
    SentinelAddrs: []string{":26379"},
})
client.Ping()

func (*Client) Append Uses

func (c *Client) Append(key, value string) *IntCmd

func (*Client) BLPop Uses

func (c *Client) BLPop(timeout time.Duration, keys ...string) *StringSliceCmd

Code:

if err := client.RPush("queue", "message").Err(); err != nil {
    panic(err)
}

// use `client.BLPop(0, "queue")` for infinite waiting time
result, err := client.BLPop(1*time.Second, "queue").Result()
if err != nil {
    panic(err)
}

fmt.Println(result[0], result[1])

Output:

queue message

func (*Client) BRPop Uses

func (c *Client) BRPop(timeout time.Duration, keys ...string) *StringSliceCmd

func (*Client) BRPopLPush Uses

func (c *Client) BRPopLPush(source, destination string, timeout time.Duration) *StringCmd

func (*Client) BgRewriteAOF Uses

func (c *Client) BgRewriteAOF() *StatusCmd

func (*Client) BgSave Uses

func (c *Client) BgSave() *StatusCmd

func (*Client) BitCount Uses

func (c *Client) BitCount(key string, bitCount *BitCount) *IntCmd

func (*Client) BitOpAnd Uses

func (c *Client) BitOpAnd(destKey string, keys ...string) *IntCmd

func (*Client) BitOpNot Uses

func (c *Client) BitOpNot(destKey string, key string) *IntCmd

func (*Client) BitOpOr Uses

func (c *Client) BitOpOr(destKey string, keys ...string) *IntCmd

func (*Client) BitOpXor Uses

func (c *Client) BitOpXor(destKey string, keys ...string) *IntCmd

func (*Client) BitPos Uses

func (c *Client) BitPos(key string, bit int64, pos ...int64) *IntCmd

func (*Client) ClientKill Uses

func (c *Client) ClientKill(ipPort string) *StatusCmd

func (*Client) ClientList Uses

func (c *Client) ClientList() *StringCmd

func (*Client) ClientPause Uses

func (c *Client) ClientPause(dur time.Duration) *BoolCmd

func (*Client) Close Uses

func (c *Client) Close() error

Close closes the client, releasing any open resources.

It is rare to Close a Client, as the Client is meant to be long-lived and shared between many goroutines.

func (*Client) ClusterAddSlots Uses

func (c *Client) ClusterAddSlots(slots ...int) *StatusCmd

func (*Client) ClusterAddSlotsRange Uses

func (c *Client) ClusterAddSlotsRange(min, max int) *StatusCmd

func (*Client) ClusterCountFailureReports Uses

func (c *Client) ClusterCountFailureReports(nodeID string) *IntCmd

func (*Client) ClusterCountKeysInSlot Uses

func (c *Client) ClusterCountKeysInSlot(slot int) *IntCmd

func (*Client) ClusterDelSlots Uses

func (c *Client) ClusterDelSlots(slots ...int) *StatusCmd

func (*Client) ClusterDelSlotsRange Uses

func (c *Client) ClusterDelSlotsRange(min, max int) *StatusCmd

func (*Client) ClusterFailover Uses

func (c *Client) ClusterFailover() *StatusCmd

func (*Client) ClusterForget Uses

func (c *Client) ClusterForget(nodeID string) *StatusCmd

func (*Client) ClusterInfo Uses

func (c *Client) ClusterInfo() *StringCmd

func (*Client) ClusterKeySlot Uses

func (c *Client) ClusterKeySlot(key string) *IntCmd

func (*Client) ClusterMeet Uses

func (c *Client) ClusterMeet(host, port string) *StatusCmd

func (*Client) ClusterNodes Uses

func (c *Client) ClusterNodes() *StringCmd

func (*Client) ClusterReplicate Uses

func (c *Client) ClusterReplicate(nodeID string) *StatusCmd

func (*Client) ClusterResetHard Uses

func (c *Client) ClusterResetHard() *StatusCmd

func (*Client) ClusterResetSoft Uses

func (c *Client) ClusterResetSoft() *StatusCmd

func (*Client) ClusterSaveConfig Uses

func (c *Client) ClusterSaveConfig() *StatusCmd

func (*Client) ClusterSlaves Uses

func (c *Client) ClusterSlaves(nodeID string) *StringSliceCmd

func (*Client) ClusterSlots Uses

func (c *Client) ClusterSlots() *ClusterSlotsCmd

func (*Client) Command Uses

func (c *Client) Command() *CommandsInfoCmd

func (*Client) ConfigGet Uses

func (c *Client) ConfigGet(parameter string) *SliceCmd

func (*Client) ConfigResetStat Uses

func (c *Client) ConfigResetStat() *StatusCmd

func (*Client) ConfigSet Uses

func (c *Client) ConfigSet(parameter, value string) *StatusCmd

func (*Client) Context Uses

func (c *Client) Context() context.Context

func (*Client) DbSize Uses

func (c *Client) DbSize() *IntCmd

func (*Client) DebugObject Uses

func (c *Client) DebugObject(key string) *StringCmd

func (*Client) Decr Uses

func (c *Client) Decr(key string) *IntCmd

func (*Client) DecrBy Uses

func (c *Client) DecrBy(key string, decrement int64) *IntCmd

func (*Client) Del Uses

func (c *Client) Del(keys ...string) *IntCmd

func (*Client) Dump Uses

func (c *Client) Dump(key string) *StringCmd

func (*Client) Echo Uses

func (c *Client) Echo(message interface{}) *StringCmd

func (*Client) Eval Uses

func (c *Client) Eval(script string, keys []string, args ...interface{}) *Cmd

func (*Client) EvalSha Uses

func (c *Client) EvalSha(sha1 string, keys []string, args ...interface{}) *Cmd

func (*Client) Exists Uses

func (c *Client) Exists(key string) *BoolCmd

func (*Client) ExistsMulti Uses

func (c *Client) ExistsMulti(keys ...string) *IntCmd

func (*Client) Expire Uses

func (c *Client) Expire(key string, expiration time.Duration) *BoolCmd

func (*Client) ExpireAt Uses

func (c *Client) ExpireAt(key string, tm time.Time) *BoolCmd

func (*Client) FlushAll Uses

func (c *Client) FlushAll() *StatusCmd

func (*Client) FlushDb Uses

func (c *Client) FlushDb() *StatusCmd

func (*Client) GeoAdd Uses

func (c *Client) GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd

func (*Client) GeoDist Uses

func (c *Client) GeoDist(key string, member1, member2, unit string) *FloatCmd

func (*Client) GeoHash Uses

func (c *Client) GeoHash(key string, members ...string) *StringSliceCmd

func (*Client) GeoPos Uses

func (c *Client) GeoPos(key string, members ...string) *GeoPosCmd

func (*Client) GeoRadius Uses

func (c *Client) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd

func (*Client) GeoRadiusByMember Uses

func (c *Client) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd

func (*Client) Get Uses

func (c *Client) Get(key string) *StringCmd

func (*Client) GetBit Uses

func (c *Client) GetBit(key string, offset int64) *IntCmd

func (*Client) GetRange Uses

func (c *Client) GetRange(key string, start, end int64) *StringCmd

func (*Client) GetSet Uses

func (c *Client) GetSet(key string, value interface{}) *StringCmd

func (*Client) HDel Uses

func (c *Client) HDel(key string, fields ...string) *IntCmd

func (*Client) HExists Uses

func (c *Client) HExists(key, field string) *BoolCmd

func (*Client) HGet Uses

func (c *Client) HGet(key, field string) *StringCmd

func (*Client) HGetAll Uses

func (c *Client) HGetAll(key string) *StringStringMapCmd

func (*Client) HIncrBy Uses

func (c *Client) HIncrBy(key, field string, incr int64) *IntCmd

func (*Client) HIncrByFloat Uses

func (c *Client) HIncrByFloat(key, field string, incr float64) *FloatCmd

func (*Client) HKeys Uses

func (c *Client) HKeys(key string) *StringSliceCmd

func (*Client) HLen Uses

func (c *Client) HLen(key string) *IntCmd

func (*Client) HMGet Uses

func (c *Client) HMGet(key string, fields ...string) *SliceCmd

func (*Client) HMSet Uses

func (c *Client) HMSet(key string, fields map[string]string) *StatusCmd

func (*Client) HScan Uses

func (c *Client) HScan(key string, cursor uint64, match string, count int64) *ScanCmd

func (*Client) HSet Uses

func (c *Client) HSet(key, field string, value interface{}) *BoolCmd

func (*Client) HSetNX Uses

func (c *Client) HSetNX(key, field string, value interface{}) *BoolCmd

func (*Client) HVals Uses

func (c *Client) HVals(key string) *StringSliceCmd

func (*Client) Incr Uses

func (c *Client) Incr(key string) *IntCmd

Code:

if err := client.Incr("counter").Err(); err != nil {
    panic(err)
}

n, err := client.Get("counter").Int64()
fmt.Println(n, err)

Output:

1 <nil>

func (*Client) IncrBy Uses

func (c *Client) IncrBy(key string, value int64) *IntCmd

func (*Client) IncrByFloat Uses

func (c *Client) IncrByFloat(key string, value float64) *FloatCmd

func (*Client) Info Uses

func (c *Client) Info(section ...string) *StringCmd

func (*Client) Keys Uses

func (c *Client) Keys(pattern string) *StringSliceCmd

func (*Client) LIndex Uses

func (c *Client) LIndex(key string, index int64) *StringCmd

func (*Client) LInsert Uses

func (c *Client) LInsert(key, op string, pivot, value interface{}) *IntCmd

func (*Client) LInsertAfter Uses

func (c *Client) LInsertAfter(key string, pivot, value interface{}) *IntCmd

func (*Client) LInsertBefore Uses

func (c *Client) LInsertBefore(key string, pivot, value interface{}) *IntCmd

func (*Client) LLen Uses

func (c *Client) LLen(key string) *IntCmd

func (*Client) LPop Uses

func (c *Client) LPop(key string) *StringCmd

func (*Client) LPush Uses

func (c *Client) LPush(key string, values ...interface{}) *IntCmd

func (*Client) LPushX Uses

func (c *Client) LPushX(key string, value interface{}) *IntCmd

func (*Client) LRange Uses

func (c *Client) LRange(key string, start, stop int64) *StringSliceCmd

func (*Client) LRem Uses

func (c *Client) LRem(key string, count int64, value interface{}) *IntCmd

func (*Client) LSet Uses

func (c *Client) LSet(key string, index int64, value interface{}) *StatusCmd

func (*Client) LTrim Uses

func (c *Client) LTrim(key string, start, stop int64) *StatusCmd

func (*Client) LastSave Uses

func (c *Client) LastSave() *IntCmd

func (*Client) MGet Uses

func (c *Client) MGet(keys ...string) *SliceCmd

func (*Client) MSet Uses

func (c *Client) MSet(pairs ...interface{}) *StatusCmd

func (*Client) MSetNX Uses

func (c *Client) MSetNX(pairs ...interface{}) *BoolCmd

func (*Client) Migrate Uses

func (c *Client) Migrate(host, port, key string, db int64, timeout time.Duration) *StatusCmd

func (*Client) Move Uses

func (c *Client) Move(key string, db int64) *BoolCmd

func (*Client) ObjectEncoding Uses

func (c *Client) ObjectEncoding(key string) *StringCmd

func (*Client) ObjectIdleTime Uses

func (c *Client) ObjectIdleTime(key string) *DurationCmd

func (*Client) ObjectRefCount Uses

func (c *Client) ObjectRefCount(key string) *IntCmd

func (*Client) PExpire Uses

func (c *Client) PExpire(key string, expiration time.Duration) *BoolCmd

func (*Client) PExpireAt Uses

func (c *Client) PExpireAt(key string, tm time.Time) *BoolCmd

func (*Client) PFAdd Uses

func (c *Client) PFAdd(key string, els ...interface{}) *IntCmd

func (*Client) PFCount Uses

func (c *Client) PFCount(keys ...string) *IntCmd

func (*Client) PFMerge Uses

func (c *Client) PFMerge(dest string, keys ...string) *StatusCmd

func (*Client) PSubscribe Uses

func (c *Client) PSubscribe(channels ...string) (*PubSub, error)

PSubscribe subscribes the client to the given patterns.

func (*Client) PTTL Uses

func (c *Client) PTTL(key string) *DurationCmd

func (*Client) Persist Uses

func (c *Client) Persist(key string) *BoolCmd

func (*Client) Ping Uses

func (c *Client) Ping() *StatusCmd

func (*Client) Pipeline Uses

func (c *Client) Pipeline() *Pipeline

Code:

pipe := client.Pipeline()

incr := pipe.Incr("pipeline_counter")
pipe.Expire("pipeline_counter", time.Hour)

// Execute
//
//     INCR pipeline_counter
//     EXPIRE pipeline_counts 3600
//
// using one client-server roundtrip.
_, err := pipe.Exec()
fmt.Println(incr.Val(), err)

Output:

1 <nil>

func (*Client) Pipelined Uses

func (c *Client) Pipelined(fn func(*Pipeline) error) ([]Cmder, error)

Code:

var incr *redis.IntCmd
_, err := client.Pipelined(func(pipe *redis.Pipeline) error {
    incr = pipe.Incr("pipelined_counter")
    pipe.Expire("pipelined_counter", time.Hour)
    return nil
})
fmt.Println(incr.Val(), err)

Output:

1 <nil>

func (*Client) PoolStats Uses

func (c *Client) PoolStats() *PoolStats

PoolStats returns connection pool stats.

func (*Client) Process Uses

func (c *Client) Process(cmd Cmder) error

func (*Client) PubSubChannels Uses

func (c *Client) PubSubChannels(pattern string) *StringSliceCmd

func (*Client) PubSubNumPat Uses

func (c *Client) PubSubNumPat() *IntCmd

func (*Client) PubSubNumSub Uses

func (c *Client) PubSubNumSub(channels ...string) *StringIntMapCmd

func (*Client) Publish Uses

func (c *Client) Publish(channel, message string) *IntCmd

Publish posts the message to the channel.

func (*Client) Quit Uses

func (c *Client) Quit() *StatusCmd

func (*Client) RPop Uses

func (c *Client) RPop(key string) *StringCmd

func (*Client) RPopLPush Uses

func (c *Client) RPopLPush(source, destination string) *StringCmd

func (*Client) RPush Uses

func (c *Client) RPush(key string, values ...interface{}) *IntCmd

func (*Client) RPushX Uses

func (c *Client) RPushX(key string, value interface{}) *IntCmd

func (*Client) RandomKey Uses

func (c *Client) RandomKey() *StringCmd

func (*Client) Rename Uses

func (c *Client) Rename(key, newkey string) *StatusCmd

func (*Client) RenameNX Uses

func (c *Client) RenameNX(key, newkey string) *BoolCmd

func (*Client) Restore Uses

func (c *Client) Restore(key string, ttl time.Duration, value string) *StatusCmd

func (*Client) RestoreReplace Uses

func (c *Client) RestoreReplace(key string, ttl time.Duration, value string) *StatusCmd

func (*Client) SAdd Uses

func (c *Client) SAdd(key string, members ...interface{}) *IntCmd

func (*Client) SCard Uses

func (c *Client) SCard(key string) *IntCmd

func (*Client) SDiff Uses

func (c *Client) SDiff(keys ...string) *StringSliceCmd

func (*Client) SDiffStore Uses

func (c *Client) SDiffStore(destination string, keys ...string) *IntCmd

func (*Client) SInter Uses

func (c *Client) SInter(keys ...string) *StringSliceCmd

func (*Client) SInterStore Uses

func (c *Client) SInterStore(destination string, keys ...string) *IntCmd

func (*Client) SIsMember Uses

func (c *Client) SIsMember(key string, member interface{}) *BoolCmd

func (*Client) SMembers Uses

func (c *Client) SMembers(key string) *StringSliceCmd

func (*Client) SMove Uses

func (c *Client) SMove(source, destination string, member interface{}) *BoolCmd

func (*Client) SPop Uses

func (c *Client) SPop(key string) *StringCmd

Redis `SPOP key` command.

func (*Client) SPopN Uses

func (c *Client) SPopN(key string, count int64) *StringSliceCmd

Redis `SPOP key count` command.

func (*Client) SRandMember Uses

func (c *Client) SRandMember(key string) *StringCmd

Redis `SRANDMEMBER key` command.

func (*Client) SRandMemberN Uses

func (c *Client) SRandMemberN(key string, count int64) *StringSliceCmd

Redis `SRANDMEMBER key count` command.

func (*Client) SRem Uses

func (c *Client) SRem(key string, members ...interface{}) *IntCmd

func (*Client) SScan Uses

func (c *Client) SScan(key string, cursor uint64, match string, count int64) *ScanCmd

func (*Client) SUnion Uses

func (c *Client) SUnion(keys ...string) *StringSliceCmd

func (*Client) SUnionStore Uses

func (c *Client) SUnionStore(destination string, keys ...string) *IntCmd

func (*Client) Save Uses

func (c *Client) Save() *StatusCmd

func (*Client) Scan Uses

func (c *Client) Scan(cursor uint64, match string, count int64) *ScanCmd

Code:

client.FlushDb()
for i := 0; i < 33; i++ {
    err := client.Set(fmt.Sprintf("key%d", i), "value", 0).Err()
    if err != nil {
        panic(err)
    }
}

var cursor uint64
var n int
for {
    var keys []string
    var err error
    keys, cursor, err = client.Scan(cursor, "", 10).Result()
    if err != nil {
        panic(err)
    }
    n += len(keys)
    if cursor == 0 {
        break
    }
}

fmt.Printf("found %d keys\n", n)

Output:

found 33 keys

func (*Client) ScriptExists Uses

func (c *Client) ScriptExists(scripts ...string) *BoolSliceCmd

func (*Client) ScriptFlush Uses

func (c *Client) ScriptFlush() *StatusCmd

func (*Client) ScriptKill Uses

func (c *Client) ScriptKill() *StatusCmd

func (*Client) ScriptLoad Uses

func (c *Client) ScriptLoad(script string) *StringCmd

func (*Client) Set Uses

func (c *Client) Set(key string, value interface{}, expiration time.Duration) *StatusCmd

Redis `SET key value [expiration]` command.

Use expiration for `SETEX`-like behavior. Zero expiration means the key has no expiration time.

Code:

// Last argument is expiration. Zero means the key has no
// expiration time.
err := client.Set("key", "value", 0).Err()
if err != nil {
    panic(err)
}

// key2 will expire in an hour.
err = client.Set("key2", "value", time.Hour).Err()
if err != nil {
    panic(err)
}

func (*Client) SetBit Uses

func (c *Client) SetBit(key string, offset int64, value int) *IntCmd

func (*Client) SetNX Uses

func (c *Client) SetNX(key string, value interface{}, expiration time.Duration) *BoolCmd

Redis `SET key value [expiration] NX` command.

Zero expiration means the key has no expiration time.

func (*Client) SetRange Uses

func (c *Client) SetRange(key string, offset int64, value string) *IntCmd

func (*Client) SetXX Uses

func (c *Client) SetXX(key string, value interface{}, expiration time.Duration) *BoolCmd

Redis `SET key value [expiration] XX` command.

Zero expiration means the key has no expiration time.

func (*Client) Shutdown Uses

func (c *Client) Shutdown() *StatusCmd

func (*Client) ShutdownNoSave Uses

func (c *Client) ShutdownNoSave() *StatusCmd

func (*Client) ShutdownSave Uses

func (c *Client) ShutdownSave() *StatusCmd

func (*Client) SlaveOf Uses

func (c *Client) SlaveOf(host, port string) *StatusCmd

func (*Client) SlowLog Uses

func (c *Client) SlowLog()

func (*Client) Sort Uses

func (c *Client) Sort(key string, sort Sort) *StringSliceCmd

func (*Client) SortInterfaces Uses

func (c *Client) SortInterfaces(key string, sort Sort) *SliceCmd

func (*Client) StrLen Uses

func (c *Client) StrLen(key string) *IntCmd

func (*Client) String Uses

func (c *Client) String() string

func (*Client) Subscribe Uses

func (c *Client) Subscribe(channels ...string) (*PubSub, error)

Subscribe subscribes the client to the specified channels.

func (*Client) Sync Uses

func (c *Client) Sync()

func (*Client) TTL Uses

func (c *Client) TTL(key string) *DurationCmd

func (*Client) Time Uses

func (c *Client) Time() *TimeCmd

func (*Client) TxPipeline Uses

func (c *Client) TxPipeline() *Pipeline

TxPipeline acts like Pipeline, but wraps queued commands with MULTI/EXEC.

Code:

pipe := client.TxPipeline()

incr := pipe.Incr("tx_pipeline_counter")
pipe.Expire("tx_pipeline_counter", time.Hour)

// Execute
//
//     MULTI
//     INCR pipeline_counter
//     EXPIRE pipeline_counts 3600
//     EXEC
//
// using one client-server roundtrip.
_, err := pipe.Exec()
fmt.Println(incr.Val(), err)

Output:

1 <nil>

func (*Client) TxPipelined Uses

func (c *Client) TxPipelined(fn func(*Pipeline) error) ([]Cmder, error)

Code:

var incr *redis.IntCmd
_, err := client.TxPipelined(func(pipe *redis.Pipeline) error {
    incr = pipe.Incr("tx_pipelined_counter")
    pipe.Expire("tx_pipelined_counter", time.Hour)
    return nil
})
fmt.Println(incr.Val(), err)

Output:

1 <nil>

func (*Client) Type Uses

func (c *Client) Type(key string) *StatusCmd
func (c *Client) Unlink(keys ...string) *IntCmd

func (*Client) Wait Uses

func (c *Client) Wait(numSlaves int, timeout time.Duration) *IntCmd

func (*Client) Watch Uses

func (c *Client) Watch(fn func(*Tx) error, keys ...string) error

Code:

var incr func(string) error

// Transactionally increments key using GET and SET commands.
incr = func(key string) error {
    err := client.Watch(func(tx *redis.Tx) error {
        n, err := tx.Get(key).Int64()
        if err != nil && err != redis.Nil {
            return err
        }

        _, err = tx.Pipelined(func(pipe *redis.Pipeline) error {
            pipe.Set(key, strconv.FormatInt(n+1, 10), 0)
            return nil
        })
        return err
    }, key)
    if err == redis.TxFailedErr {
        return incr(key)
    }
    return err
}

var wg sync.WaitGroup
for i := 0; i < 100; i++ {
    wg.Add(1)
    go func() {
        defer wg.Done()

        err := incr("counter3")
        if err != nil {
            panic(err)
        }
    }()
}
wg.Wait()

n, err := client.Get("counter3").Int64()
fmt.Println(n, err)

Output:

100 <nil>

func (*Client) WithContext Uses

func (c *Client) WithContext(ctx context.Context) *Client

func (*Client) WrapProcess Uses

func (c *Client) WrapProcess(fn func(oldProcess func(cmd Cmder) error) func(cmd Cmder) error)

WrapProcess replaces the process func. It takes a function createWrapper which is supplied by the user. createWrapper takes the old process func as an input and returns the new wrapper process func. createWrapper should use call the old process func within the new process func.

func (*Client) ZAdd Uses

func (c *Client) ZAdd(key string, members ...Z) *IntCmd

Redis `ZADD key score member [score member ...]` command.

func (*Client) ZAddCh Uses

func (c *Client) ZAddCh(key string, members ...Z) *IntCmd

Redis `ZADD key CH score member [score member ...]` command.

func (*Client) ZAddNX Uses

func (c *Client) ZAddNX(key string, members ...Z) *IntCmd

Redis `ZADD key NX score member [score member ...]` command.

func (*Client) ZAddNXCh Uses

func (c *Client) ZAddNXCh(key string, members ...Z) *IntCmd

Redis `ZADD key NX CH score member [score member ...]` command.

func (*Client) ZAddXX Uses

func (c *Client) ZAddXX(key string, members ...Z) *IntCmd

Redis `ZADD key XX score member [score member ...]` command.

func (*Client) ZAddXXCh Uses

func (c *Client) ZAddXXCh(key string, members ...Z) *IntCmd

Redis `ZADD key XX CH score member [score member ...]` command.

func (*Client) ZCard Uses

func (c *Client) ZCard(key string) *IntCmd

func (*Client) ZCount Uses

func (c *Client) ZCount(key, min, max string) *IntCmd

func (*Client) ZIncr Uses

func (c *Client) ZIncr(key string, member Z) *FloatCmd

Redis `ZADD key INCR score member` command.

func (*Client) ZIncrBy Uses

func (c *Client) ZIncrBy(key string, increment float64, member string) *FloatCmd

func (*Client) ZIncrNX Uses

func (c *Client) ZIncrNX(key string, member Z) *FloatCmd

Redis `ZADD key NX INCR score member` command.

func (*Client) ZIncrXX Uses

func (c *Client) ZIncrXX(key string, member Z) *FloatCmd

Redis `ZADD key XX INCR score member` command.

func (*Client) ZInterStore Uses

func (c *Client) ZInterStore(destination string, store ZStore, keys ...string) *IntCmd

func (*Client) ZRange Uses

func (c *Client) ZRange(key string, start, stop int64) *StringSliceCmd

func (*Client) ZRangeByLex Uses

func (c *Client) ZRangeByLex(key string, opt ZRangeBy) *StringSliceCmd

func (*Client) ZRangeByScore Uses

func (c *Client) ZRangeByScore(key string, opt ZRangeBy) *StringSliceCmd

func (*Client) ZRangeByScoreWithScores Uses

func (c *Client) ZRangeByScoreWithScores(key string, opt ZRangeBy) *ZSliceCmd

func (*Client) ZRangeWithScores Uses

func (c *Client) ZRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*Client) ZRank Uses

func (c *Client) ZRank(key, member string) *IntCmd

func (*Client) ZRem Uses

func (c *Client) ZRem(key string, members ...interface{}) *IntCmd

func (*Client) ZRemRangeByLex Uses

func (c *Client) ZRemRangeByLex(key, min, max string) *IntCmd

func (*Client) ZRemRangeByRank Uses

func (c *Client) ZRemRangeByRank(key string, start, stop int64) *IntCmd

func (*Client) ZRemRangeByScore Uses

func (c *Client) ZRemRangeByScore(key, min, max string) *IntCmd

func (*Client) ZRevRange Uses

func (c *Client) ZRevRange(key string, start, stop int64) *StringSliceCmd

func (*Client) ZRevRangeByLex Uses

func (c *Client) ZRevRangeByLex(key string, opt ZRangeBy) *StringSliceCmd

func (*Client) ZRevRangeByScore Uses

func (c *Client) ZRevRangeByScore(key string, opt ZRangeBy) *StringSliceCmd

func (*Client) ZRevRangeByScoreWithScores Uses

func (c *Client) ZRevRangeByScoreWithScores(key string, opt ZRangeBy) *ZSliceCmd

func (*Client) ZRevRangeWithScores Uses

func (c *Client) ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*Client) ZRevRank Uses

func (c *Client) ZRevRank(key, member string) *IntCmd

func (*Client) ZScan Uses

func (c *Client) ZScan(key string, cursor uint64, match string, count int64) *ScanCmd

func (*Client) ZScore Uses

func (c *Client) ZScore(key, member string) *FloatCmd

func (*Client) ZUnionStore Uses

func (c *Client) ZUnionStore(dest string, store ZStore, keys ...string) *IntCmd

type ClusterClient Uses

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

ClusterClient is a Redis Cluster client representing a pool of zero or more underlying connections. It's safe for concurrent use by multiple goroutines.

func NewClusterClient Uses

func NewClusterClient(opt *ClusterOptions) *ClusterClient

NewClusterClient returns a Redis Cluster client as described in http://redis.io/topics/cluster-spec.

Code:

// See http://redis.io/topics/cluster-tutorial for instructions
// how to setup Redis Cluster.
client := redis.NewClusterClient(&redis.ClusterOptions{
    Addrs: []string{":7000", ":7001", ":7002", ":7003", ":7004", ":7005"},
})
client.Ping()

func (*ClusterClient) Append Uses

func (c *ClusterClient) Append(key, value string) *IntCmd

func (*ClusterClient) BLPop Uses

func (c *ClusterClient) BLPop(timeout time.Duration, keys ...string) *StringSliceCmd

func (*ClusterClient) BRPop Uses

func (c *ClusterClient) BRPop(timeout time.Duration, keys ...string) *StringSliceCmd

func (*ClusterClient) BRPopLPush Uses

func (c *ClusterClient) BRPopLPush(source, destination string, timeout time.Duration) *StringCmd

func (*ClusterClient) BgRewriteAOF Uses

func (c *ClusterClient) BgRewriteAOF() *StatusCmd

func (*ClusterClient) BgSave Uses

func (c *ClusterClient) BgSave() *StatusCmd

func (*ClusterClient) BitCount Uses

func (c *ClusterClient) BitCount(key string, bitCount *BitCount) *IntCmd

func (*ClusterClient) BitOpAnd Uses

func (c *ClusterClient) BitOpAnd(destKey string, keys ...string) *IntCmd

func (*ClusterClient) BitOpNot Uses

func (c *ClusterClient) BitOpNot(destKey string, key string) *IntCmd

func (*ClusterClient) BitOpOr Uses

func (c *ClusterClient) BitOpOr(destKey string, keys ...string) *IntCmd

func (*ClusterClient) BitOpXor Uses

func (c *ClusterClient) BitOpXor(destKey string, keys ...string) *IntCmd

func (*ClusterClient) BitPos Uses

func (c *ClusterClient) BitPos(key string, bit int64, pos ...int64) *IntCmd

func (*ClusterClient) ClientKill Uses

func (c *ClusterClient) ClientKill(ipPort string) *StatusCmd

func (*ClusterClient) ClientList Uses

func (c *ClusterClient) ClientList() *StringCmd

func (*ClusterClient) ClientPause Uses

func (c *ClusterClient) ClientPause(dur time.Duration) *BoolCmd

func (*ClusterClient) Close Uses

func (c *ClusterClient) Close() error

Close closes the cluster client, releasing any open resources.

It is rare to Close a ClusterClient, as the ClusterClient is meant to be long-lived and shared between many goroutines.

func (*ClusterClient) ClusterAddSlots Uses

func (c *ClusterClient) ClusterAddSlots(slots ...int) *StatusCmd

func (*ClusterClient) ClusterAddSlotsRange Uses

func (c *ClusterClient) ClusterAddSlotsRange(min, max int) *StatusCmd

func (*ClusterClient) ClusterCountFailureReports Uses

func (c *ClusterClient) ClusterCountFailureReports(nodeID string) *IntCmd

func (*ClusterClient) ClusterCountKeysInSlot Uses

func (c *ClusterClient) ClusterCountKeysInSlot(slot int) *IntCmd

func (*ClusterClient) ClusterDelSlots Uses

func (c *ClusterClient) ClusterDelSlots(slots ...int) *StatusCmd

func (*ClusterClient) ClusterDelSlotsRange Uses

func (c *ClusterClient) ClusterDelSlotsRange(min, max int) *StatusCmd

func (*ClusterClient) ClusterFailover Uses

func (c *ClusterClient) ClusterFailover() *StatusCmd

func (*ClusterClient) ClusterForget Uses

func (c *ClusterClient) ClusterForget(nodeID string) *StatusCmd

func (*ClusterClient) ClusterInfo Uses

func (c *ClusterClient) ClusterInfo() *StringCmd

func (*ClusterClient) ClusterKeySlot Uses

func (c *ClusterClient) ClusterKeySlot(key string) *IntCmd

func (*ClusterClient) ClusterMeet Uses

func (c *ClusterClient) ClusterMeet(host, port string) *StatusCmd

func (*ClusterClient) ClusterNodes Uses

func (c *ClusterClient) ClusterNodes() *StringCmd

func (*ClusterClient) ClusterReplicate Uses

func (c *ClusterClient) ClusterReplicate(nodeID string) *StatusCmd

func (*ClusterClient) ClusterResetHard Uses

func (c *ClusterClient) ClusterResetHard() *StatusCmd

func (*ClusterClient) ClusterResetSoft Uses

func (c *ClusterClient) ClusterResetSoft() *StatusCmd

func (*ClusterClient) ClusterSaveConfig Uses

func (c *ClusterClient) ClusterSaveConfig() *StatusCmd

func (*ClusterClient) ClusterSlaves Uses

func (c *ClusterClient) ClusterSlaves(nodeID string) *StringSliceCmd

func (*ClusterClient) ClusterSlots Uses

func (c *ClusterClient) ClusterSlots() *ClusterSlotsCmd

func (*ClusterClient) Command Uses

func (c *ClusterClient) Command() *CommandsInfoCmd

func (*ClusterClient) ConfigGet Uses

func (c *ClusterClient) ConfigGet(parameter string) *SliceCmd

func (*ClusterClient) ConfigResetStat Uses

func (c *ClusterClient) ConfigResetStat() *StatusCmd

func (*ClusterClient) ConfigSet Uses

func (c *ClusterClient) ConfigSet(parameter, value string) *StatusCmd

func (*ClusterClient) DbSize Uses

func (c *ClusterClient) DbSize() *IntCmd

func (*ClusterClient) DebugObject Uses

func (c *ClusterClient) DebugObject(key string) *StringCmd

func (*ClusterClient) Decr Uses

func (c *ClusterClient) Decr(key string) *IntCmd

func (*ClusterClient) DecrBy Uses

func (c *ClusterClient) DecrBy(key string, decrement int64) *IntCmd

func (*ClusterClient) Del Uses

func (c *ClusterClient) Del(keys ...string) *IntCmd

func (*ClusterClient) Dump Uses

func (c *ClusterClient) Dump(key string) *StringCmd

func (*ClusterClient) Echo Uses

func (c *ClusterClient) Echo(message interface{}) *StringCmd

func (*ClusterClient) Eval Uses

func (c *ClusterClient) Eval(script string, keys []string, args ...interface{}) *Cmd

func (*ClusterClient) EvalSha Uses

func (c *ClusterClient) EvalSha(sha1 string, keys []string, args ...interface{}) *Cmd

func (*ClusterClient) Exists Uses

func (c *ClusterClient) Exists(key string) *BoolCmd

func (*ClusterClient) ExistsMulti Uses

func (c *ClusterClient) ExistsMulti(keys ...string) *IntCmd

func (*ClusterClient) Expire Uses

func (c *ClusterClient) Expire(key string, expiration time.Duration) *BoolCmd

func (*ClusterClient) ExpireAt Uses

func (c *ClusterClient) ExpireAt(key string, tm time.Time) *BoolCmd

func (*ClusterClient) FlushAll Uses

func (c *ClusterClient) FlushAll() *StatusCmd

func (*ClusterClient) FlushDb Uses

func (c *ClusterClient) FlushDb() *StatusCmd

func (*ClusterClient) ForEachMaster Uses

func (c *ClusterClient) ForEachMaster(fn func(client *Client) error) error

ForEachMaster concurrently calls the fn on each master node in the cluster. It returns the first error if any.

func (*ClusterClient) ForEachNode Uses

func (c *ClusterClient) ForEachNode(fn func(client *Client) error) error

ForEachNode concurrently calls the fn on each ever known node in the cluster. It returns the first error if any.

func (*ClusterClient) GeoAdd Uses

func (c *ClusterClient) GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd

func (*ClusterClient) GeoDist Uses

func (c *ClusterClient) GeoDist(key string, member1, member2, unit string) *FloatCmd

func (*ClusterClient) GeoHash Uses

func (c *ClusterClient) GeoHash(key string, members ...string) *StringSliceCmd

func (*ClusterClient) GeoPos Uses

func (c *ClusterClient) GeoPos(key string, members ...string) *GeoPosCmd

func (*ClusterClient) GeoRadius Uses

func (c *ClusterClient) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd

func (*ClusterClient) GeoRadiusByMember Uses

func (c *ClusterClient) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd

func (*ClusterClient) Get Uses

func (c *ClusterClient) Get(key string) *StringCmd

func (*ClusterClient) GetBit Uses

func (c *ClusterClient) GetBit(key string, offset int64) *IntCmd

func (*ClusterClient) GetRange Uses

func (c *ClusterClient) GetRange(key string, start, end int64) *StringCmd

func (*ClusterClient) GetSet Uses

func (c *ClusterClient) GetSet(key string, value interface{}) *StringCmd

func (*ClusterClient) HDel Uses

func (c *ClusterClient) HDel(key string, fields ...string) *IntCmd

func (*ClusterClient) HExists Uses

func (c *ClusterClient) HExists(key, field string) *BoolCmd

func (*ClusterClient) HGet Uses

func (c *ClusterClient) HGet(key, field string) *StringCmd

func (*ClusterClient) HGetAll Uses

func (c *ClusterClient) HGetAll(key string) *StringStringMapCmd

func (*ClusterClient) HIncrBy Uses

func (c *ClusterClient) HIncrBy(key, field string, incr int64) *IntCmd

func (*ClusterClient) HIncrByFloat Uses

func (c *ClusterClient) HIncrByFloat(key, field string, incr float64) *FloatCmd

func (*ClusterClient) HKeys Uses

func (c *ClusterClient) HKeys(key string) *StringSliceCmd

func (*ClusterClient) HLen Uses

func (c *ClusterClient) HLen(key string) *IntCmd

func (*ClusterClient) HMGet Uses

func (c *ClusterClient) HMGet(key string, fields ...string) *SliceCmd

func (*ClusterClient) HMSet Uses

func (c *ClusterClient) HMSet(key string, fields map[string]string) *StatusCmd

func (*ClusterClient) HScan Uses

func (c *ClusterClient) HScan(key string, cursor uint64, match string, count int64) *ScanCmd

func (*ClusterClient) HSet Uses

func (c *ClusterClient) HSet(key, field string, value interface{}) *BoolCmd

func (*ClusterClient) HSetNX Uses

func (c *ClusterClient) HSetNX(key, field string, value interface{}) *BoolCmd

func (*ClusterClient) HVals Uses

func (c *ClusterClient) HVals(key string) *StringSliceCmd

func (*ClusterClient) Incr Uses

func (c *ClusterClient) Incr(key string) *IntCmd

func (*ClusterClient) IncrBy Uses

func (c *ClusterClient) IncrBy(key string, value int64) *IntCmd

func (*ClusterClient) IncrByFloat Uses

func (c *ClusterClient) IncrByFloat(key string, value float64) *FloatCmd

func (*ClusterClient) Info Uses

func (c *ClusterClient) Info(section ...string) *StringCmd

func (*ClusterClient) Keys Uses

func (c *ClusterClient) Keys(pattern string) *StringSliceCmd

func (*ClusterClient) LIndex Uses

func (c *ClusterClient) LIndex(key string, index int64) *StringCmd

func (*ClusterClient) LInsert Uses

func (c *ClusterClient) LInsert(key, op string, pivot, value interface{}) *IntCmd

func (*ClusterClient) LInsertAfter Uses

func (c *ClusterClient) LInsertAfter(key string, pivot, value interface{}) *IntCmd

func (*ClusterClient) LInsertBefore Uses

func (c *ClusterClient) LInsertBefore(key string, pivot, value interface{}) *IntCmd

func (*ClusterClient) LLen Uses

func (c *ClusterClient) LLen(key string) *IntCmd

func (*ClusterClient) LPop Uses

func (c *ClusterClient) LPop(key string) *StringCmd

func (*ClusterClient) LPush Uses

func (c *ClusterClient) LPush(key string, values ...interface{}) *IntCmd

func (*ClusterClient) LPushX Uses

func (c *ClusterClient) LPushX(key string, value interface{}) *IntCmd

func (*ClusterClient) LRange Uses

func (c *ClusterClient) LRange(key string, start, stop int64) *StringSliceCmd

func (*ClusterClient) LRem Uses

func (c *ClusterClient) LRem(key string, count int64, value interface{}) *IntCmd

func (*ClusterClient) LSet Uses

func (c *ClusterClient) LSet(key string, index int64, value interface{}) *StatusCmd

func (*ClusterClient) LTrim Uses

func (c *ClusterClient) LTrim(key string, start, stop int64) *StatusCmd

func (*ClusterClient) LastSave Uses

func (c *ClusterClient) LastSave() *IntCmd

func (*ClusterClient) MGet Uses

func (c *ClusterClient) MGet(keys ...string) *SliceCmd

func (*ClusterClient) MSet Uses

func (c *ClusterClient) MSet(pairs ...interface{}) *StatusCmd

func (*ClusterClient) MSetNX Uses

func (c *ClusterClient) MSetNX(pairs ...interface{}) *BoolCmd

func (*ClusterClient) Migrate Uses

func (c *ClusterClient) Migrate(host, port, key string, db int64, timeout time.Duration) *StatusCmd

func (*ClusterClient) Move Uses

func (c *ClusterClient) Move(key string, db int64) *BoolCmd

func (*ClusterClient) ObjectEncoding Uses

func (c *ClusterClient) ObjectEncoding(key string) *StringCmd

func (*ClusterClient) ObjectIdleTime Uses

func (c *ClusterClient) ObjectIdleTime(key string) *DurationCmd

func (*ClusterClient) ObjectRefCount Uses

func (c *ClusterClient) ObjectRefCount(key string) *IntCmd

func (*ClusterClient) PExpire Uses

func (c *ClusterClient) PExpire(key string, expiration time.Duration) *BoolCmd

func (*ClusterClient) PExpireAt Uses

func (c *ClusterClient) PExpireAt(key string, tm time.Time) *BoolCmd

func (*ClusterClient) PFAdd Uses

func (c *ClusterClient) PFAdd(key string, els ...interface{}) *IntCmd

func (*ClusterClient) PFCount Uses

func (c *ClusterClient) PFCount(keys ...string) *IntCmd

func (*ClusterClient) PFMerge Uses

func (c *ClusterClient) PFMerge(dest string, keys ...string) *StatusCmd

func (*ClusterClient) PTTL Uses

func (c *ClusterClient) PTTL(key string) *DurationCmd

func (*ClusterClient) Persist Uses

func (c *ClusterClient) Persist(key string) *BoolCmd

func (*ClusterClient) Ping Uses

func (c *ClusterClient) Ping() *StatusCmd

func (*ClusterClient) Pipeline Uses

func (c *ClusterClient) Pipeline() *Pipeline

func (*ClusterClient) Pipelined Uses

func (c *ClusterClient) Pipelined(fn func(*Pipeline) error) ([]Cmder, error)

func (*ClusterClient) PoolStats Uses

func (c *ClusterClient) PoolStats() *PoolStats

PoolStats returns accumulated connection pool stats.

func (*ClusterClient) Process Uses

func (c *ClusterClient) Process(cmd Cmder) error

func (*ClusterClient) PubSubChannels Uses

func (c *ClusterClient) PubSubChannels(pattern string) *StringSliceCmd

func (*ClusterClient) PubSubNumPat Uses

func (c *ClusterClient) PubSubNumPat() *IntCmd

func (*ClusterClient) PubSubNumSub Uses

func (c *ClusterClient) PubSubNumSub(channels ...string) *StringIntMapCmd

func (*ClusterClient) Publish Uses

func (c *ClusterClient) Publish(channel, message string) *IntCmd

Publish posts the message to the channel.

func (*ClusterClient) Quit Uses

func (c *ClusterClient) Quit() *StatusCmd

func (*ClusterClient) RPop Uses

func (c *ClusterClient) RPop(key string) *StringCmd

func (*ClusterClient) RPopLPush Uses

func (c *ClusterClient) RPopLPush(source, destination string) *StringCmd

func (*ClusterClient) RPush Uses

func (c *ClusterClient) RPush(key string, values ...interface{}) *IntCmd

func (*ClusterClient) RPushX Uses

func (c *ClusterClient) RPushX(key string, value interface{}) *IntCmd

func (*ClusterClient) RandomKey Uses

func (c *ClusterClient) RandomKey() *StringCmd

func (*ClusterClient) Rename Uses

func (c *ClusterClient) Rename(key, newkey string) *StatusCmd

func (*ClusterClient) RenameNX Uses

func (c *ClusterClient) RenameNX(key, newkey string) *BoolCmd

func (*ClusterClient) Restore Uses

func (c *ClusterClient) Restore(key string, ttl time.Duration, value string) *StatusCmd

func (*ClusterClient) RestoreReplace Uses

func (c *ClusterClient) RestoreReplace(key string, ttl time.Duration, value string) *StatusCmd

func (*ClusterClient) SAdd Uses

func (c *ClusterClient) SAdd(key string, members ...interface{}) *IntCmd

func (*ClusterClient) SCard Uses

func (c *ClusterClient) SCard(key string) *IntCmd

func (*ClusterClient) SDiff Uses

func (c *ClusterClient) SDiff(keys ...string) *StringSliceCmd

func (*ClusterClient) SDiffStore Uses

func (c *ClusterClient) SDiffStore(destination string, keys ...string) *IntCmd

func (*ClusterClient) SInter Uses

func (c *ClusterClient) SInter(keys ...string) *StringSliceCmd

func (*ClusterClient) SInterStore Uses

func (c *ClusterClient) SInterStore(destination string, keys ...string) *IntCmd

func (*ClusterClient) SIsMember Uses

func (c *ClusterClient) SIsMember(key string, member interface{}) *BoolCmd

func (*ClusterClient) SMembers Uses

func (c *ClusterClient) SMembers(key string) *StringSliceCmd

func (*ClusterClient) SMove Uses

func (c *ClusterClient) SMove(source, destination string, member interface{}) *BoolCmd

func (*ClusterClient) SPop Uses

func (c *ClusterClient) SPop(key string) *StringCmd

Redis `SPOP key` command.

func (*ClusterClient) SPopN Uses

func (c *ClusterClient) SPopN(key string, count int64) *StringSliceCmd

Redis `SPOP key count` command.

func (*ClusterClient) SRandMember Uses

func (c *ClusterClient) SRandMember(key string) *StringCmd

Redis `SRANDMEMBER key` command.

func (*ClusterClient) SRandMemberN Uses

func (c *ClusterClient) SRandMemberN(key string, count int64) *StringSliceCmd

Redis `SRANDMEMBER key count` command.

func (*ClusterClient) SRem Uses

func (c *ClusterClient) SRem(key string, members ...interface{}) *IntCmd

func (*ClusterClient) SScan Uses

func (c *ClusterClient) SScan(key string, cursor uint64, match string, count int64) *ScanCmd

func (*ClusterClient) SUnion Uses

func (c *ClusterClient) SUnion(keys ...string) *StringSliceCmd

func (*ClusterClient) SUnionStore Uses

func (c *ClusterClient) SUnionStore(destination string, keys ...string) *IntCmd

func (*ClusterClient) Save Uses

func (c *ClusterClient) Save() *StatusCmd

func (*ClusterClient) Scan Uses

func (c *ClusterClient) Scan(cursor uint64, match string, count int64) *ScanCmd

func (*ClusterClient) ScriptExists Uses

func (c *ClusterClient) ScriptExists(scripts ...string) *BoolSliceCmd

func (*ClusterClient) ScriptFlush Uses

func (c *ClusterClient) ScriptFlush() *StatusCmd

func (*ClusterClient) ScriptKill Uses

func (c *ClusterClient) ScriptKill() *StatusCmd

func (*ClusterClient) ScriptLoad Uses

func (c *ClusterClient) ScriptLoad(script string) *StringCmd

func (*ClusterClient) Set Uses

func (c *ClusterClient) Set(key string, value interface{}, expiration time.Duration) *StatusCmd

Redis `SET key value [expiration]` command.

Use expiration for `SETEX`-like behavior. Zero expiration means the key has no expiration time.

func (*ClusterClient) SetBit Uses

func (c *ClusterClient) SetBit(key string, offset int64, value int) *IntCmd

func (*ClusterClient) SetNX Uses

func (c *ClusterClient) SetNX(key string, value interface{}, expiration time.Duration) *BoolCmd

Redis `SET key value [expiration] NX` command.

Zero expiration means the key has no expiration time.

func (*ClusterClient) SetRange Uses

func (c *ClusterClient) SetRange(key string, offset int64, value string) *IntCmd

func (*ClusterClient) SetXX Uses

func (c *ClusterClient) SetXX(key string, value interface{}, expiration time.Duration) *BoolCmd

Redis `SET key value [expiration] XX` command.

Zero expiration means the key has no expiration time.

func (*ClusterClient) Shutdown Uses

func (c *ClusterClient) Shutdown() *StatusCmd

func (*ClusterClient) ShutdownNoSave Uses

func (c *ClusterClient) ShutdownNoSave() *StatusCmd

func (*ClusterClient) ShutdownSave Uses

func (c *ClusterClient) ShutdownSave() *StatusCmd

func (*ClusterClient) SlaveOf Uses

func (c *ClusterClient) SlaveOf(host, port string) *StatusCmd

func (*ClusterClient) SlowLog Uses

func (c *ClusterClient) SlowLog()

func (*ClusterClient) Sort Uses

func (c *ClusterClient) Sort(key string, sort Sort) *StringSliceCmd

func (*ClusterClient) SortInterfaces Uses

func (c *ClusterClient) SortInterfaces(key string, sort Sort) *SliceCmd

func (*ClusterClient) StrLen Uses

func (c *ClusterClient) StrLen(key string) *IntCmd

func (*ClusterClient) Sync Uses

func (c *ClusterClient) Sync()

func (*ClusterClient) TTL Uses

func (c *ClusterClient) TTL(key string) *DurationCmd

func (*ClusterClient) Time Uses

func (c *ClusterClient) Time() *TimeCmd

func (*ClusterClient) TxPipeline Uses

func (c *ClusterClient) TxPipeline() *Pipeline

TxPipeline acts like Pipeline, but wraps queued commands with MULTI/EXEC.

func (*ClusterClient) TxPipelined Uses

func (c *ClusterClient) TxPipelined(fn func(*Pipeline) error) ([]Cmder, error)

func (*ClusterClient) Type Uses

func (c *ClusterClient) Type(key string) *StatusCmd
func (c *ClusterClient) Unlink(keys ...string) *IntCmd

func (*ClusterClient) Wait Uses

func (c *ClusterClient) Wait(numSlaves int, timeout time.Duration) *IntCmd

func (*ClusterClient) Watch Uses

func (c *ClusterClient) Watch(fn func(*Tx) error, keys ...string) error

func (*ClusterClient) ZAdd Uses

func (c *ClusterClient) ZAdd(key string, members ...Z) *IntCmd

Redis `ZADD key score member [score member ...]` command.

func (*ClusterClient) ZAddCh Uses

func (c *ClusterClient) ZAddCh(key string, members ...Z) *IntCmd

Redis `ZADD key CH score member [score member ...]` command.

func (*ClusterClient) ZAddNX Uses

func (c *ClusterClient) ZAddNX(key string, members ...Z) *IntCmd

Redis `ZADD key NX score member [score member ...]` command.

func (*ClusterClient) ZAddNXCh Uses

func (c *ClusterClient) ZAddNXCh(key string, members ...Z) *IntCmd

Redis `ZADD key NX CH score member [score member ...]` command.

func (*ClusterClient) ZAddXX Uses

func (c *ClusterClient) ZAddXX(key string, members ...Z) *IntCmd

Redis `ZADD key XX score member [score member ...]` command.

func (*ClusterClient) ZAddXXCh Uses

func (c *ClusterClient) ZAddXXCh(key string, members ...Z) *IntCmd

Redis `ZADD key XX CH score member [score member ...]` command.

func (*ClusterClient) ZCard Uses

func (c *ClusterClient) ZCard(key string) *IntCmd

func (*ClusterClient) ZCount Uses

func (c *ClusterClient) ZCount(key, min, max string) *IntCmd

func (*ClusterClient) ZIncr Uses

func (c *ClusterClient) ZIncr(key string, member Z) *FloatCmd

Redis `ZADD key INCR score member` command.

func (*ClusterClient) ZIncrBy Uses

func (c *ClusterClient) ZIncrBy(key string, increment float64, member string) *FloatCmd

func (*ClusterClient) ZIncrNX Uses

func (c *ClusterClient) ZIncrNX(key string, member Z) *FloatCmd

Redis `ZADD key NX INCR score member` command.

func (*ClusterClient) ZIncrXX Uses

func (c *ClusterClient) ZIncrXX(key string, member Z) *FloatCmd

Redis `ZADD key XX INCR score member` command.

func (*ClusterClient) ZInterStore Uses

func (c *ClusterClient) ZInterStore(destination string, store ZStore, keys ...string) *IntCmd

func (*ClusterClient) ZRange Uses

func (c *ClusterClient) ZRange(key string, start, stop int64) *StringSliceCmd

func (*ClusterClient) ZRangeByLex Uses

func (c *ClusterClient) ZRangeByLex(key string, opt ZRangeBy) *StringSliceCmd

func (*ClusterClient) ZRangeByScore Uses

func (c *ClusterClient) ZRangeByScore(key string, opt ZRangeBy) *StringSliceCmd

func (*ClusterClient) ZRangeByScoreWithScores Uses

func (c *ClusterClient) ZRangeByScoreWithScores(key string, opt ZRangeBy) *ZSliceCmd

func (*ClusterClient) ZRangeWithScores Uses

func (c *ClusterClient) ZRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*ClusterClient) ZRank Uses

func (c *ClusterClient) ZRank(key, member string) *IntCmd

func (*ClusterClient) ZRem Uses

func (c *ClusterClient) ZRem(key string, members ...interface{}) *IntCmd

func (*ClusterClient) ZRemRangeByLex Uses

func (c *ClusterClient) ZRemRangeByLex(key, min, max string) *IntCmd

func (*ClusterClient) ZRemRangeByRank Uses

func (c *ClusterClient) ZRemRangeByRank(key string, start, stop int64) *IntCmd

func (*ClusterClient) ZRemRangeByScore Uses

func (c *ClusterClient) ZRemRangeByScore(key, min, max string) *IntCmd

func (*ClusterClient) ZRevRange Uses

func (c *ClusterClient) ZRevRange(key string, start, stop int64) *StringSliceCmd

func (*ClusterClient) ZRevRangeByLex Uses

func (c *ClusterClient) ZRevRangeByLex(key string, opt ZRangeBy) *StringSliceCmd

func (*ClusterClient) ZRevRangeByScore Uses

func (c *ClusterClient) ZRevRangeByScore(key string, opt ZRangeBy) *StringSliceCmd

func (*ClusterClient) ZRevRangeByScoreWithScores Uses

func (c *ClusterClient) ZRevRangeByScoreWithScores(key string, opt ZRangeBy) *ZSliceCmd

func (*ClusterClient) ZRevRangeWithScores Uses

func (c *ClusterClient) ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*ClusterClient) ZRevRank Uses

func (c *ClusterClient) ZRevRank(key, member string) *IntCmd

func (*ClusterClient) ZScan Uses

func (c *ClusterClient) ZScan(key string, cursor uint64, match string, count int64) *ScanCmd

func (*ClusterClient) ZScore Uses

func (c *ClusterClient) ZScore(key, member string) *FloatCmd

func (*ClusterClient) ZUnionStore Uses

func (c *ClusterClient) ZUnionStore(dest string, store ZStore, keys ...string) *IntCmd

type ClusterNode Uses

type ClusterNode struct {
    Id   string
    Addr string
}

type ClusterOptions Uses

type ClusterOptions struct {
    // A seed list of host:port addresses of cluster nodes.
    Addrs []string

    // The maximum number of retries before giving up. Command is retried
    // on network errors and MOVED/ASK redirects.
    // Default is 16.
    MaxRedirects int

    // Enables read queries for a connection to a Redis Cluster slave node.
    ReadOnly bool

    // Enables routing read-only queries to the closest master or slave node.
    RouteByLatency bool

    Password string

    DialTimeout  time.Duration
    ReadTimeout  time.Duration
    WriteTimeout time.Duration

    // PoolSize applies per cluster node and not for the whole cluster.
    PoolSize           int
    PoolTimeout        time.Duration
    IdleTimeout        time.Duration
    IdleCheckFrequency time.Duration
}

ClusterOptions are used to configure a cluster client and should be passed to NewClusterClient.

type ClusterSlot Uses

type ClusterSlot struct {
    Start int
    End   int
    Nodes []ClusterNode
}

type ClusterSlotsCmd Uses

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

func NewClusterSlotsCmd Uses

func NewClusterSlotsCmd(args ...interface{}) *ClusterSlotsCmd

func NewClusterSlotsCmdResult Uses

func NewClusterSlotsCmdResult(val []ClusterSlot, err error) *ClusterSlotsCmd

NewClusterSlotsCmdResult returns a ClusterSlotsCmd initalised with val and err for testing

func (*ClusterSlotsCmd) Err Uses

func (cmd *ClusterSlotsCmd) Err() error

func (*ClusterSlotsCmd) Result Uses

func (cmd *ClusterSlotsCmd) Result() ([]ClusterSlot, error)

func (*ClusterSlotsCmd) String Uses

func (cmd *ClusterSlotsCmd) String() string

func (*ClusterSlotsCmd) Val Uses

func (cmd *ClusterSlotsCmd) Val() []ClusterSlot

type Cmd Uses

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

func NewCmd Uses

func NewCmd(args ...interface{}) *Cmd

func NewCmdResult Uses

func NewCmdResult(val interface{}, err error) *Cmd

NewCmdResult returns a Cmd initalised with val and err for testing

func (*Cmd) Err Uses

func (cmd *Cmd) Err() error

func (*Cmd) Result Uses

func (cmd *Cmd) Result() (interface{}, error)

func (*Cmd) String Uses

func (cmd *Cmd) String() string

func (*Cmd) Val Uses

func (cmd *Cmd) Val() interface{}

type Cmdable Uses

type Cmdable interface {
    Pipeline() *Pipeline
    Pipelined(fn func(*Pipeline) error) ([]Cmder, error)

    Echo(message interface{}) *StringCmd
    Ping() *StatusCmd
    Quit() *StatusCmd
    Del(keys ...string) *IntCmd
    Unlink(keys ...string) *IntCmd
    Dump(key string) *StringCmd
    Exists(key string) *BoolCmd
    // TODO: merge with Exists in v6
    ExistsMulti(keys ...string) *IntCmd
    Expire(key string, expiration time.Duration) *BoolCmd
    ExpireAt(key string, tm time.Time) *BoolCmd
    Keys(pattern string) *StringSliceCmd
    Migrate(host, port, key string, db int64, timeout time.Duration) *StatusCmd
    Move(key string, db int64) *BoolCmd
    ObjectRefCount(key string) *IntCmd
    ObjectEncoding(key string) *StringCmd
    ObjectIdleTime(key string) *DurationCmd
    Persist(key string) *BoolCmd
    PExpire(key string, expiration time.Duration) *BoolCmd
    PExpireAt(key string, tm time.Time) *BoolCmd
    PTTL(key string) *DurationCmd
    RandomKey() *StringCmd
    Rename(key, newkey string) *StatusCmd
    RenameNX(key, newkey string) *BoolCmd
    Restore(key string, ttl time.Duration, value string) *StatusCmd
    RestoreReplace(key string, ttl time.Duration, value string) *StatusCmd
    Sort(key string, sort Sort) *StringSliceCmd
    SortInterfaces(key string, sort Sort) *SliceCmd
    TTL(key string) *DurationCmd
    Type(key string) *StatusCmd
    Scan(cursor uint64, match string, count int64) *ScanCmd
    SScan(key string, cursor uint64, match string, count int64) *ScanCmd
    HScan(key string, cursor uint64, match string, count int64) *ScanCmd
    ZScan(key string, cursor uint64, match string, count int64) *ScanCmd
    Append(key, value string) *IntCmd
    BitCount(key string, bitCount *BitCount) *IntCmd
    BitOpAnd(destKey string, keys ...string) *IntCmd
    BitOpOr(destKey string, keys ...string) *IntCmd
    BitOpXor(destKey string, keys ...string) *IntCmd
    BitOpNot(destKey string, key string) *IntCmd
    BitPos(key string, bit int64, pos ...int64) *IntCmd
    Decr(key string) *IntCmd
    DecrBy(key string, decrement int64) *IntCmd
    Get(key string) *StringCmd
    GetBit(key string, offset int64) *IntCmd
    GetRange(key string, start, end int64) *StringCmd
    GetSet(key string, value interface{}) *StringCmd
    Incr(key string) *IntCmd
    IncrBy(key string, value int64) *IntCmd
    IncrByFloat(key string, value float64) *FloatCmd
    MGet(keys ...string) *SliceCmd
    MSet(pairs ...interface{}) *StatusCmd
    MSetNX(pairs ...interface{}) *BoolCmd
    Set(key string, value interface{}, expiration time.Duration) *StatusCmd
    SetBit(key string, offset int64, value int) *IntCmd
    SetNX(key string, value interface{}, expiration time.Duration) *BoolCmd
    SetXX(key string, value interface{}, expiration time.Duration) *BoolCmd
    SetRange(key string, offset int64, value string) *IntCmd
    StrLen(key string) *IntCmd
    HDel(key string, fields ...string) *IntCmd
    HExists(key, field string) *BoolCmd
    HGet(key, field string) *StringCmd
    HGetAll(key string) *StringStringMapCmd
    HIncrBy(key, field string, incr int64) *IntCmd
    HIncrByFloat(key, field string, incr float64) *FloatCmd
    HKeys(key string) *StringSliceCmd
    HLen(key string) *IntCmd
    HMGet(key string, fields ...string) *SliceCmd
    HMSet(key string, fields map[string]string) *StatusCmd
    HSet(key, field string, value interface{}) *BoolCmd
    HSetNX(key, field string, value interface{}) *BoolCmd
    HVals(key string) *StringSliceCmd
    BLPop(timeout time.Duration, keys ...string) *StringSliceCmd
    BRPop(timeout time.Duration, keys ...string) *StringSliceCmd
    BRPopLPush(source, destination string, timeout time.Duration) *StringCmd
    LIndex(key string, index int64) *StringCmd
    LInsert(key, op string, pivot, value interface{}) *IntCmd
    LInsertBefore(key string, pivot, value interface{}) *IntCmd
    LInsertAfter(key string, pivot, value interface{}) *IntCmd
    LLen(key string) *IntCmd
    LPop(key string) *StringCmd
    LPush(key string, values ...interface{}) *IntCmd
    LPushX(key string, value interface{}) *IntCmd
    LRange(key string, start, stop int64) *StringSliceCmd
    LRem(key string, count int64, value interface{}) *IntCmd
    LSet(key string, index int64, value interface{}) *StatusCmd
    LTrim(key string, start, stop int64) *StatusCmd
    RPop(key string) *StringCmd
    RPopLPush(source, destination string) *StringCmd
    RPush(key string, values ...interface{}) *IntCmd
    RPushX(key string, value interface{}) *IntCmd
    SAdd(key string, members ...interface{}) *IntCmd
    SCard(key string) *IntCmd
    SDiff(keys ...string) *StringSliceCmd
    SDiffStore(destination string, keys ...string) *IntCmd
    SInter(keys ...string) *StringSliceCmd
    SInterStore(destination string, keys ...string) *IntCmd
    SIsMember(key string, member interface{}) *BoolCmd
    SMembers(key string) *StringSliceCmd
    SMove(source, destination string, member interface{}) *BoolCmd
    SPop(key string) *StringCmd
    SPopN(key string, count int64) *StringSliceCmd
    SRandMember(key string) *StringCmd
    SRandMemberN(key string, count int64) *StringSliceCmd
    SRem(key string, members ...interface{}) *IntCmd
    SUnion(keys ...string) *StringSliceCmd
    SUnionStore(destination string, keys ...string) *IntCmd
    ZAdd(key string, members ...Z) *IntCmd
    ZAddNX(key string, members ...Z) *IntCmd
    ZAddXX(key string, members ...Z) *IntCmd
    ZAddCh(key string, members ...Z) *IntCmd
    ZAddNXCh(key string, members ...Z) *IntCmd
    ZAddXXCh(key string, members ...Z) *IntCmd
    ZIncr(key string, member Z) *FloatCmd
    ZIncrNX(key string, member Z) *FloatCmd
    ZIncrXX(key string, member Z) *FloatCmd
    ZCard(key string) *IntCmd
    ZCount(key, min, max string) *IntCmd
    ZIncrBy(key string, increment float64, member string) *FloatCmd
    ZInterStore(destination string, store ZStore, keys ...string) *IntCmd
    ZRange(key string, start, stop int64) *StringSliceCmd
    ZRangeWithScores(key string, start, stop int64) *ZSliceCmd
    ZRangeByScore(key string, opt ZRangeBy) *StringSliceCmd
    ZRangeByLex(key string, opt ZRangeBy) *StringSliceCmd
    ZRangeByScoreWithScores(key string, opt ZRangeBy) *ZSliceCmd
    ZRank(key, member string) *IntCmd
    ZRem(key string, members ...interface{}) *IntCmd
    ZRemRangeByRank(key string, start, stop int64) *IntCmd
    ZRemRangeByScore(key, min, max string) *IntCmd
    ZRemRangeByLex(key, min, max string) *IntCmd
    ZRevRange(key string, start, stop int64) *StringSliceCmd
    ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd
    ZRevRangeByScore(key string, opt ZRangeBy) *StringSliceCmd
    ZRevRangeByLex(key string, opt ZRangeBy) *StringSliceCmd
    ZRevRangeByScoreWithScores(key string, opt ZRangeBy) *ZSliceCmd
    ZRevRank(key, member string) *IntCmd
    ZScore(key, member string) *FloatCmd
    ZUnionStore(dest string, store ZStore, keys ...string) *IntCmd
    PFAdd(key string, els ...interface{}) *IntCmd
    PFCount(keys ...string) *IntCmd
    PFMerge(dest string, keys ...string) *StatusCmd
    BgRewriteAOF() *StatusCmd
    BgSave() *StatusCmd
    ClientKill(ipPort string) *StatusCmd
    ClientList() *StringCmd
    ClientPause(dur time.Duration) *BoolCmd
    ConfigGet(parameter string) *SliceCmd
    ConfigResetStat() *StatusCmd
    ConfigSet(parameter, value string) *StatusCmd
    DbSize() *IntCmd
    FlushAll() *StatusCmd
    FlushDb() *StatusCmd
    Info(section ...string) *StringCmd
    LastSave() *IntCmd
    Save() *StatusCmd
    Shutdown() *StatusCmd
    ShutdownSave() *StatusCmd
    ShutdownNoSave() *StatusCmd
    SlaveOf(host, port string) *StatusCmd
    Time() *TimeCmd
    Eval(script string, keys []string, args ...interface{}) *Cmd
    EvalSha(sha1 string, keys []string, args ...interface{}) *Cmd
    ScriptExists(scripts ...string) *BoolSliceCmd
    ScriptFlush() *StatusCmd
    ScriptKill() *StatusCmd
    ScriptLoad(script string) *StringCmd
    DebugObject(key string) *StringCmd
    PubSubChannels(pattern string) *StringSliceCmd
    PubSubNumSub(channels ...string) *StringIntMapCmd
    PubSubNumPat() *IntCmd
    ClusterSlots() *ClusterSlotsCmd
    ClusterNodes() *StringCmd
    ClusterMeet(host, port string) *StatusCmd
    ClusterForget(nodeID string) *StatusCmd
    ClusterReplicate(nodeID string) *StatusCmd
    ClusterResetSoft() *StatusCmd
    ClusterResetHard() *StatusCmd
    ClusterInfo() *StringCmd
    ClusterKeySlot(key string) *IntCmd
    ClusterCountFailureReports(nodeID string) *IntCmd
    ClusterCountKeysInSlot(slot int) *IntCmd
    ClusterDelSlots(slots ...int) *StatusCmd
    ClusterDelSlotsRange(min, max int) *StatusCmd
    ClusterSaveConfig() *StatusCmd
    ClusterSlaves(nodeID string) *StringSliceCmd
    ClusterFailover() *StatusCmd
    ClusterAddSlots(slots ...int) *StatusCmd
    ClusterAddSlotsRange(min, max int) *StatusCmd
    GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd
    GeoPos(key string, members ...string) *GeoPosCmd
    GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd
    GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd
    GeoDist(key string, member1, member2, unit string) *FloatCmd
    GeoHash(key string, members ...string) *StringSliceCmd
    Command() *CommandsInfoCmd
}

type Cmder Uses

type Cmder interface {
    Err() error
    fmt.Stringer
    // contains filtered or unexported methods
}

type CommandInfo Uses

type CommandInfo struct {
    Name        string
    Arity       int8
    Flags       []string
    FirstKeyPos int8
    LastKeyPos  int8
    StepCount   int8
    ReadOnly    bool
}

type CommandsInfoCmd Uses

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

func NewCommandsInfoCmd Uses

func NewCommandsInfoCmd(args ...interface{}) *CommandsInfoCmd

func NewCommandsInfoCmdResult Uses

func NewCommandsInfoCmdResult(val map[string]*CommandInfo, err error) *CommandsInfoCmd

NewCommandsInfoCmdResult returns a CommandsInfoCmd initalised with val and err for testing

func (*CommandsInfoCmd) Err Uses

func (cmd *CommandsInfoCmd) Err() error

func (*CommandsInfoCmd) Result Uses

func (cmd *CommandsInfoCmd) Result() (map[string]*CommandInfo, error)

func (*CommandsInfoCmd) String Uses

func (cmd *CommandsInfoCmd) String() string

func (*CommandsInfoCmd) Val Uses

func (cmd *CommandsInfoCmd) Val() map[string]*CommandInfo

type DurationCmd Uses

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

func NewDurationCmd Uses

func NewDurationCmd(precision time.Duration, args ...interface{}) *DurationCmd

func NewDurationResult Uses

func NewDurationResult(val time.Duration, err error) *DurationCmd

NewDurationResult returns a DurationCmd initalised with val and err for testing

func (*DurationCmd) Err Uses

func (cmd *DurationCmd) Err() error

func (*DurationCmd) Result Uses

func (cmd *DurationCmd) Result() (time.Duration, error)

func (*DurationCmd) String Uses

func (cmd *DurationCmd) String() string

func (*DurationCmd) Val Uses

func (cmd *DurationCmd) Val() time.Duration

type FailoverOptions Uses

type FailoverOptions struct {
    // The master name.
    MasterName string
    // A seed list of host:port addresses of sentinel nodes.
    SentinelAddrs []string

    Password string
    DB       int

    MaxRetries int

    DialTimeout  time.Duration
    ReadTimeout  time.Duration
    WriteTimeout time.Duration

    PoolSize           int
    PoolTimeout        time.Duration
    IdleTimeout        time.Duration
    IdleCheckFrequency time.Duration
}

FailoverOptions are used to configure a failover client and should be passed to NewFailoverClient.

type FloatCmd Uses

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

func NewFloatCmd Uses

func NewFloatCmd(args ...interface{}) *FloatCmd

func NewFloatResult Uses

func NewFloatResult(val float64, err error) *FloatCmd

NewFloatResult returns a FloatCmd initalised with val and err for testing

func (*FloatCmd) Err Uses

func (cmd *FloatCmd) Err() error

func (*FloatCmd) Result Uses

func (cmd *FloatCmd) Result() (float64, error)

func (*FloatCmd) String Uses

func (cmd *FloatCmd) String() string

func (*FloatCmd) Val Uses

func (cmd *FloatCmd) Val() float64

type GeoLocation Uses

type GeoLocation struct {
    Name                      string
    Longitude, Latitude, Dist float64
    GeoHash                   int64
}

GeoLocation is used with GeoAdd to add geospatial location.

type GeoLocationCmd Uses

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

func NewGeoLocationCmd Uses

func NewGeoLocationCmd(q *GeoRadiusQuery, args ...interface{}) *GeoLocationCmd

func NewGeoLocationCmdResult Uses

func NewGeoLocationCmdResult(val []GeoLocation, err error) *GeoLocationCmd

NewGeoLocationCmdResult returns a GeoLocationCmd initalised with val and err for testing

func (*GeoLocationCmd) Err Uses

func (cmd *GeoLocationCmd) Err() error

func (*GeoLocationCmd) Result Uses

func (cmd *GeoLocationCmd) Result() ([]GeoLocation, error)

func (*GeoLocationCmd) String Uses

func (cmd *GeoLocationCmd) String() string

func (*GeoLocationCmd) Val Uses

func (cmd *GeoLocationCmd) Val() []GeoLocation

type GeoPos Uses

type GeoPos struct {
    Longitude, Latitude float64
}

type GeoPosCmd Uses

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

func NewGeoPosCmd Uses

func NewGeoPosCmd(args ...interface{}) *GeoPosCmd

func (*GeoPosCmd) Err Uses

func (cmd *GeoPosCmd) Err() error

func (*GeoPosCmd) Result Uses

func (cmd *GeoPosCmd) Result() ([]*GeoPos, error)

func (*GeoPosCmd) String Uses

func (cmd *GeoPosCmd) String() string

func (*GeoPosCmd) Val Uses

func (cmd *GeoPosCmd) Val() []*GeoPos

type GeoRadiusQuery Uses

type GeoRadiusQuery struct {
    Radius float64
    // Can be m, km, ft, or mi. Default is km.
    Unit        string
    WithCoord   bool
    WithDist    bool
    WithGeoHash bool
    Count       int
    // Can be ASC or DESC. Default is no sort order.
    Sort string
}

GeoRadiusQuery is used with GeoRadius to query geospatial index.

type IntCmd Uses

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

func NewIntCmd Uses

func NewIntCmd(args ...interface{}) *IntCmd

func NewIntResult Uses

func NewIntResult(val int64, err error) *IntCmd

NewIntResult returns an IntCmd initalised with val and err for testing

func (*IntCmd) Err Uses

func (cmd *IntCmd) Err() error

func (*IntCmd) Result Uses

func (cmd *IntCmd) Result() (int64, error)

func (*IntCmd) String Uses

func (cmd *IntCmd) String() string

func (*IntCmd) Val Uses

func (cmd *IntCmd) Val() int64

type Message Uses

type Message struct {
    Channel string
    Pattern string
    Payload string
}

Message received as result of a PUBLISH command issued by another client.

func (*Message) String Uses

func (m *Message) String() string

type Options Uses

type Options struct {
    // The network type, either tcp or unix.
    // Default is tcp.
    Network string
    // host:port address.
    Addr string

    // Dialer creates new network connection and has priority over
    // Network and Addr options.
    Dialer func() (net.Conn, error)

    // Optional password. Must match the password specified in the
    // requirepass server configuration option.
    Password string
    // Database to be selected after connecting to the server.
    DB  int

    // Maximum number of retries before giving up.
    // Default is to not retry failed commands.
    MaxRetries int

    // Dial timeout for establishing new connections.
    // Default is 5 seconds.
    DialTimeout time.Duration
    // Timeout for socket reads. If reached, commands will fail
    // with a timeout instead of blocking.
    // Default is 3 seconds.
    ReadTimeout time.Duration
    // Timeout for socket writes. If reached, commands will fail
    // with a timeout instead of blocking.
    // Default is 3 seconds.
    WriteTimeout time.Duration

    // Maximum number of socket connections.
    // Default is 10 connections.
    PoolSize int
    // Amount of time client waits for connection if all connections
    // are busy before returning an error.
    // Default is ReadTimeout + 1 second.
    PoolTimeout time.Duration
    // Amount of time after which client closes idle connections.
    // Should be less than server's timeout.
    // Default is to not close idle connections.
    IdleTimeout time.Duration
    // Frequency of idle checks.
    // Default is 1 minute.
    // When minus value is set, then idle check is disabled.
    IdleCheckFrequency time.Duration

    // Enables read only queries on slave nodes.
    ReadOnly bool

    // TLS Config to use. When set TLS will be negotiated.
    TLSConfig *tls.Config
}

func ParseURL Uses

func ParseURL(redisURL string) (*Options, error)

ParseURL parses a redis URL into options that can be used to connect to redis

type Pipeline Uses

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

Pipeline implements pipelining as described in http://redis.io/topics/pipelining. It's safe for concurrent use by multiple goroutines.

func (*Pipeline) Append Uses

func (c *Pipeline) Append(key, value string) *IntCmd

func (*Pipeline) Auth Uses

func (c *Pipeline) Auth(password string) *StatusCmd

func (*Pipeline) BLPop Uses

func (c *Pipeline) BLPop(timeout time.Duration, keys ...string) *StringSliceCmd

func (*Pipeline) BRPop Uses

func (c *Pipeline) BRPop(timeout time.Duration, keys ...string) *StringSliceCmd

func (*Pipeline) BRPopLPush Uses

func (c *Pipeline) BRPopLPush(source, destination string, timeout time.Duration) *StringCmd

func (*Pipeline) BgRewriteAOF Uses

func (c *Pipeline) BgRewriteAOF() *StatusCmd

func (*Pipeline) BgSave Uses

func (c *Pipeline) BgSave() *StatusCmd

func (*Pipeline) BitCount Uses

func (c *Pipeline) BitCount(key string, bitCount *BitCount) *IntCmd

func (*Pipeline) BitOpAnd Uses

func (c *Pipeline) BitOpAnd(destKey string, keys ...string) *IntCmd

func (*Pipeline) BitOpNot Uses

func (c *Pipeline) BitOpNot(destKey string, key string) *IntCmd

func (*Pipeline) BitOpOr Uses

func (c *Pipeline) BitOpOr(destKey string, keys ...string) *IntCmd

func (*Pipeline) BitOpXor Uses

func (c *Pipeline) BitOpXor(destKey string, keys ...string) *IntCmd

func (*Pipeline) BitPos Uses

func (c *Pipeline) BitPos(key string, bit int64, pos ...int64) *IntCmd

func (*Pipeline) ClientGetName Uses

func (c *Pipeline) ClientGetName() *StringCmd

ClientGetName returns the name of the connection.

func (*Pipeline) ClientKill Uses

func (c *Pipeline) ClientKill(ipPort string) *StatusCmd

func (*Pipeline) ClientList Uses

func (c *Pipeline) ClientList() *StringCmd

func (*Pipeline) ClientPause Uses

func (c *Pipeline) ClientPause(dur time.Duration) *BoolCmd

func (*Pipeline) ClientSetName Uses

func (c *Pipeline) ClientSetName(name string) *BoolCmd

ClientSetName assigns a name to the connection.

func (*Pipeline) Close Uses

func (c *Pipeline) Close() error

Close closes the pipeline, releasing any open resources.

func (*Pipeline) ClusterAddSlots Uses

func (c *Pipeline) ClusterAddSlots(slots ...int) *StatusCmd

func (*Pipeline) ClusterAddSlotsRange Uses

func (c *Pipeline) ClusterAddSlotsRange(min, max int) *StatusCmd

func (*Pipeline) ClusterCountFailureReports Uses

func (c *Pipeline) ClusterCountFailureReports(nodeID string) *IntCmd

func (*Pipeline) ClusterCountKeysInSlot Uses

func (c *Pipeline) ClusterCountKeysInSlot(slot int) *IntCmd

func (*Pipeline) ClusterDelSlots Uses

func (c *Pipeline) ClusterDelSlots(slots ...int) *StatusCmd

func (*Pipeline) ClusterDelSlotsRange Uses

func (c *Pipeline) ClusterDelSlotsRange(min, max int) *StatusCmd

func (*Pipeline) ClusterFailover Uses

func (c *Pipeline) ClusterFailover() *StatusCmd

func (*Pipeline) ClusterForget Uses

func (c *Pipeline) ClusterForget(nodeID string) *StatusCmd

func (*Pipeline) ClusterInfo Uses

func (c *Pipeline) ClusterInfo() *StringCmd

func (*Pipeline) ClusterKeySlot Uses

func (c *Pipeline) ClusterKeySlot(key string) *IntCmd

func (*Pipeline) ClusterMeet Uses

func (c *Pipeline) ClusterMeet(host, port string) *StatusCmd

func (*Pipeline) ClusterNodes Uses

func (c *Pipeline) ClusterNodes() *StringCmd

func (*Pipeline) ClusterReplicate Uses

func (c *Pipeline) ClusterReplicate(nodeID string) *StatusCmd

func (*Pipeline) ClusterResetHard Uses

func (c *Pipeline) ClusterResetHard() *StatusCmd

func (*Pipeline) ClusterResetSoft Uses

func (c *Pipeline) ClusterResetSoft() *StatusCmd

func (*Pipeline) ClusterSaveConfig Uses

func (c *Pipeline) ClusterSaveConfig() *StatusCmd

func (*Pipeline) ClusterSlaves Uses

func (c *Pipeline) ClusterSlaves(nodeID string) *StringSliceCmd

func (*Pipeline) ClusterSlots Uses

func (c *Pipeline) ClusterSlots() *ClusterSlotsCmd

func (*Pipeline) Command Uses

func (c *Pipeline) Command() *CommandsInfoCmd

func (*Pipeline) ConfigGet Uses

func (c *Pipeline) ConfigGet(parameter string) *SliceCmd

func (*Pipeline) ConfigResetStat Uses

func (c *Pipeline) ConfigResetStat() *StatusCmd

func (*Pipeline) ConfigSet Uses

func (c *Pipeline) ConfigSet(parameter, value string) *StatusCmd

func (*Pipeline) DbSize Uses

func (c *Pipeline) DbSize() *IntCmd

func (*Pipeline) DebugObject Uses

func (c *Pipeline) DebugObject(key string) *StringCmd

func (*Pipeline) Decr Uses

func (c *Pipeline) Decr(key string) *IntCmd

func (*Pipeline) DecrBy Uses

func (c *Pipeline) DecrBy(key string, decrement int64) *IntCmd

func (*Pipeline) Del Uses

func (c *Pipeline) Del(keys ...string) *IntCmd

func (*Pipeline) Discard Uses

func (c *Pipeline) Discard() error

Discard resets the pipeline and discards queued commands.

func (*Pipeline) Dump Uses

func (c *Pipeline) Dump(key string) *StringCmd

func (*Pipeline) Echo Uses

func (c *Pipeline) Echo(message interface{}) *StringCmd

func (*Pipeline) Eval Uses

func (c *Pipeline) Eval(script string, keys []string, args ...interface{}) *Cmd

func (*Pipeline) EvalSha Uses

func (c *Pipeline) EvalSha(sha1 string, keys []string, args ...interface{}) *Cmd

func (*Pipeline) Exec Uses

func (c *Pipeline) Exec() ([]Cmder, error)

Exec executes all previously queued commands using one client-server roundtrip.

Exec always returns list of commands and error of the first failed command if any.

func (*Pipeline) Exists Uses

func (c *Pipeline) Exists(key string) *BoolCmd

func (*Pipeline) ExistsMulti Uses

func (c *Pipeline) ExistsMulti(keys ...string) *IntCmd

func (*Pipeline) Expire Uses

func (c *Pipeline) Expire(key string, expiration time.Duration) *BoolCmd

func (*Pipeline) ExpireAt Uses

func (c *Pipeline) ExpireAt(key string, tm time.Time) *BoolCmd

func (*Pipeline) FlushAll Uses

func (c *Pipeline) FlushAll() *StatusCmd

func (*Pipeline) FlushDb Uses

func (c *Pipeline) FlushDb() *StatusCmd

func (*Pipeline) GeoAdd Uses

func (c *Pipeline) GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd

func (*Pipeline) GeoDist Uses

func (c *Pipeline) GeoDist(key string, member1, member2, unit string) *FloatCmd

func (*Pipeline) GeoHash Uses

func (c *Pipeline) GeoHash(key string, members ...string) *StringSliceCmd

func (*Pipeline) GeoPos Uses

func (c *Pipeline) GeoPos(key string, members ...string) *GeoPosCmd

func (*Pipeline) GeoRadius Uses

func (c *Pipeline) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd

func (*Pipeline) GeoRadiusByMember Uses

func (c *Pipeline) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd

func (*Pipeline) Get Uses

func (c *Pipeline) Get(key string) *StringCmd

func (*Pipeline) GetBit Uses

func (c *Pipeline) GetBit(key string, offset int64) *IntCmd

func (*Pipeline) GetRange Uses

func (c *Pipeline) GetRange(key string, start, end int64) *StringCmd

func (*Pipeline) GetSet Uses

func (c *Pipeline) GetSet(key string, value interface{}) *StringCmd

func (*Pipeline) HDel Uses

func (c *Pipeline) HDel(key string, fields ...string) *IntCmd

func (*Pipeline) HExists Uses

func (c *Pipeline) HExists(key, field string) *BoolCmd

func (*Pipeline) HGet Uses

func (c *Pipeline) HGet(key, field string) *StringCmd

func (*Pipeline) HGetAll Uses

func (c *Pipeline) HGetAll(key string) *StringStringMapCmd

func (*Pipeline) HIncrBy Uses

func (c *Pipeline) HIncrBy(key, field string, incr int64) *IntCmd

func (*Pipeline) HIncrByFloat Uses

func (c *Pipeline) HIncrByFloat(key, field string, incr float64) *FloatCmd

func (*Pipeline) HKeys Uses

func (c *Pipeline) HKeys(key string) *StringSliceCmd

func (*Pipeline) HLen Uses

func (c *Pipeline) HLen(key string) *IntCmd

func (*Pipeline) HMGet Uses

func (c *Pipeline) HMGet(key string, fields ...string) *SliceCmd

func (*Pipeline) HMSet Uses

func (c *Pipeline) HMSet(key string, fields map[string]string) *StatusCmd

func (*Pipeline) HScan Uses

func (c *Pipeline) HScan(key string, cursor uint64, match string, count int64) *ScanCmd

func (*Pipeline) HSet Uses

func (c *Pipeline) HSet(key, field string, value interface{}) *BoolCmd

func (*Pipeline) HSetNX Uses

func (c *Pipeline) HSetNX(key, field string, value interface{}) *BoolCmd

func (*Pipeline) HVals Uses

func (c *Pipeline) HVals(key string) *StringSliceCmd

func (*Pipeline) Incr Uses

func (c *Pipeline) Incr(key string) *IntCmd

func (*Pipeline) IncrBy Uses

func (c *Pipeline) IncrBy(key string, value int64) *IntCmd

func (*Pipeline) IncrByFloat Uses

func (c *Pipeline) IncrByFloat(key string, value float64) *FloatCmd

func (*Pipeline) Info Uses

func (c *Pipeline) Info(section ...string) *StringCmd

func (*Pipeline) Keys Uses

func (c *Pipeline) Keys(pattern string) *StringSliceCmd

func (*Pipeline) LIndex Uses

func (c *Pipeline) LIndex(key string, index int64) *StringCmd

func (*Pipeline) LInsert Uses

func (c *Pipeline) LInsert(key, op string, pivot, value interface{}) *IntCmd

func (*Pipeline) LInsertAfter Uses

func (c *Pipeline) LInsertAfter(key string, pivot, value interface{}) *IntCmd

func (*Pipeline) LInsertBefore Uses

func (c *Pipeline) LInsertBefore(key string, pivot, value interface{}) *IntCmd

func (*Pipeline) LLen Uses

func (c *Pipeline) LLen(key string) *IntCmd

func (*Pipeline) LPop Uses

func (c *Pipeline) LPop(key string) *StringCmd

func (*Pipeline) LPush Uses

func (c *Pipeline) LPush(key string, values ...interface{}) *IntCmd

func (*Pipeline) LPushX Uses

func (c *Pipeline) LPushX(key string, value interface{}) *IntCmd

func (*Pipeline) LRange Uses

func (c *Pipeline) LRange(key string, start, stop int64) *StringSliceCmd

func (*Pipeline) LRem Uses

func (c *Pipeline) LRem(key string, count int64, value interface{}) *IntCmd

func (*Pipeline) LSet Uses

func (c *Pipeline) LSet(key string, index int64, value interface{}) *StatusCmd

func (*Pipeline) LTrim Uses

func (c *Pipeline) LTrim(key string, start, stop int64) *StatusCmd

func (*Pipeline) LastSave Uses

func (c *Pipeline) LastSave() *IntCmd

func (*Pipeline) MGet Uses

func (c *Pipeline) MGet(keys ...string) *SliceCmd

func (*Pipeline) MSet Uses

func (c *Pipeline) MSet(pairs ...interface{}) *StatusCmd

func (*Pipeline) MSetNX Uses

func (c *Pipeline) MSetNX(pairs ...interface{}) *BoolCmd

func (*Pipeline) Migrate Uses

func (c *Pipeline) Migrate(host, port, key string, db int64, timeout time.Duration) *StatusCmd

func (*Pipeline) Move Uses

func (c *Pipeline) Move(key string, db int64) *BoolCmd

func (*Pipeline) ObjectEncoding Uses

func (c *Pipeline) ObjectEncoding(key string) *StringCmd

func (*Pipeline) ObjectIdleTime Uses

func (c *Pipeline) ObjectIdleTime(key string) *DurationCmd

func (*Pipeline) ObjectRefCount Uses

func (c *Pipeline) ObjectRefCount(key string) *IntCmd

func (*Pipeline) PExpire Uses

func (c *Pipeline) PExpire(key string, expiration time.Duration) *BoolCmd

func (*Pipeline) PExpireAt Uses

func (c *Pipeline) PExpireAt(key string, tm time.Time) *BoolCmd

func (*Pipeline) PFAdd Uses

func (c *Pipeline) PFAdd(key string, els ...interface{}) *IntCmd

func (*Pipeline) PFCount Uses

func (c *Pipeline) PFCount(keys ...string) *IntCmd

func (*Pipeline) PFMerge Uses

func (c *Pipeline) PFMerge(dest string, keys ...string) *StatusCmd

func (*Pipeline) PTTL Uses

func (c *Pipeline) PTTL(key string) *DurationCmd

func (*Pipeline) Persist Uses

func (c *Pipeline) Persist(key string) *BoolCmd

func (*Pipeline) Ping Uses

func (c *Pipeline) Ping() *StatusCmd

func (*Pipeline) Process Uses

func (c *Pipeline) Process(cmd Cmder) error

func (*Pipeline) PubSubChannels Uses

func (c *Pipeline) PubSubChannels(pattern string) *StringSliceCmd

func (*Pipeline) PubSubNumPat Uses

func (c *Pipeline) PubSubNumPat() *IntCmd

func (*Pipeline) PubSubNumSub Uses

func (c *Pipeline) PubSubNumSub(channels ...string) *StringIntMapCmd

func (*Pipeline) Publish Uses

func (c *Pipeline) Publish(channel, message string) *IntCmd

Publish posts the message to the channel.

func (*Pipeline) Quit Uses

func (c *Pipeline) Quit() *StatusCmd

func (*Pipeline) RPop Uses

func (c *Pipeline) RPop(key string) *StringCmd

func (*Pipeline) RPopLPush Uses

func (c *Pipeline) RPopLPush(source, destination string) *StringCmd

func (*Pipeline) RPush Uses

func (c *Pipeline) RPush(key string, values ...interface{}) *IntCmd

func (*Pipeline) RPushX Uses

func (c *Pipeline) RPushX(key string, value interface{}) *IntCmd

func (*Pipeline) RandomKey Uses

func (c *Pipeline) RandomKey() *StringCmd

func (*Pipeline) ReadOnly Uses

func (c *Pipeline) ReadOnly() *StatusCmd

func (*Pipeline) ReadWrite Uses

func (c *Pipeline) ReadWrite() *StatusCmd

func (*Pipeline) Rename Uses

func (c *Pipeline) Rename(key, newkey string) *StatusCmd

func (*Pipeline) RenameNX Uses

func (c *Pipeline) RenameNX(key, newkey string) *BoolCmd

func (*Pipeline) Restore Uses

func (c *Pipeline) Restore(key string, ttl time.Duration, value string) *StatusCmd

func (*Pipeline) RestoreReplace Uses

func (c *Pipeline) RestoreReplace(key string, ttl time.Duration, value string) *StatusCmd

func (*Pipeline) SAdd Uses

func (c *Pipeline) SAdd(key string, members ...interface{}) *IntCmd

func (*Pipeline) SCard Uses

func (c *Pipeline) SCard(key string) *IntCmd

func (*Pipeline) SDiff Uses

func (c *Pipeline) SDiff(keys ...string) *StringSliceCmd

func (*Pipeline) SDiffStore Uses

func (c *Pipeline) SDiffStore(destination string, keys ...string) *IntCmd

func (*Pipeline) SInter Uses

func (c *Pipeline) SInter(keys ...string) *StringSliceCmd

func (*Pipeline) SInterStore Uses

func (c *Pipeline) SInterStore(destination string, keys ...string) *IntCmd

func (*Pipeline) SIsMember Uses

func (c *Pipeline) SIsMember(key string, member interface{}) *BoolCmd

func (*Pipeline) SMembers Uses

func (c *Pipeline) SMembers(key string) *StringSliceCmd

func (*Pipeline) SMove Uses

func (c *Pipeline) SMove(source, destination string, member interface{}) *BoolCmd

func (*Pipeline) SPop Uses

func (c *Pipeline) SPop(key string) *StringCmd

Redis `SPOP key` command.

func (*Pipeline) SPopN Uses

func (c *Pipeline) SPopN(key string, count int64) *StringSliceCmd

Redis `SPOP key count` command.

func (*Pipeline) SRandMember Uses

func (c *Pipeline) SRandMember(key string) *StringCmd

Redis `SRANDMEMBER key` command.

func (*Pipeline) SRandMemberN Uses

func (c *Pipeline) SRandMemberN(key string, count int64) *StringSliceCmd

Redis `SRANDMEMBER key count` command.

func (*Pipeline) SRem Uses

func (c *Pipeline) SRem(key string, members ...interface{}) *IntCmd

func (*Pipeline) SScan Uses

func (c *Pipeline) SScan(key string, cursor uint64, match string, count int64) *ScanCmd

func (*Pipeline) SUnion Uses

func (c *Pipeline) SUnion(keys ...string) *StringSliceCmd

func (*Pipeline) SUnionStore Uses

func (c *Pipeline) SUnionStore(destination string, keys ...string) *IntCmd

func (*Pipeline) Save Uses

func (c *Pipeline) Save() *StatusCmd

func (*Pipeline) Scan Uses

func (c *Pipeline) Scan(cursor uint64, match string, count int64) *ScanCmd

func (*Pipeline) ScriptExists Uses

func (c *Pipeline) ScriptExists(scripts ...string) *BoolSliceCmd

func (*Pipeline) ScriptFlush Uses

func (c *Pipeline) ScriptFlush() *StatusCmd

func (*Pipeline) ScriptKill Uses

func (c *Pipeline) ScriptKill() *StatusCmd

func (*Pipeline) ScriptLoad Uses

func (c *Pipeline) ScriptLoad(script string) *StringCmd

func (*Pipeline) Select Uses

func (c *Pipeline) Select(index int) *StatusCmd

func (*Pipeline) Set Uses

func (c *Pipeline) Set(key string, value interface{}, expiration time.Duration) *StatusCmd

Redis `SET key value [expiration]` command.

Use expiration for `SETEX`-like behavior. Zero expiration means the key has no expiration time.

func (*Pipeline) SetBit Uses

func (c *Pipeline) SetBit(key string, offset int64, value int) *IntCmd

func (*Pipeline) SetNX Uses

func (c *Pipeline) SetNX(key string, value interface{}, expiration time.Duration) *BoolCmd

Redis `SET key value [expiration] NX` command.

Zero expiration means the key has no expiration time.

func (*Pipeline) SetRange Uses

func (c *Pipeline) SetRange(key string, offset int64, value string) *IntCmd

func (*Pipeline) SetXX Uses

func (c *Pipeline) SetXX(key string, value interface{}, expiration time.Duration) *BoolCmd

Redis `SET key value [expiration] XX` command.

Zero expiration means the key has no expiration time.

func (*Pipeline) Shutdown Uses

func (c *Pipeline) Shutdown() *StatusCmd

func (*Pipeline) ShutdownNoSave Uses

func (c *Pipeline) ShutdownNoSave() *StatusCmd

func (*Pipeline) ShutdownSave Uses

func (c *Pipeline) ShutdownSave() *StatusCmd

func (*Pipeline) SlaveOf Uses

func (c *Pipeline) SlaveOf(host, port string) *StatusCmd

func (*Pipeline) SlowLog Uses

func (c *Pipeline) SlowLog()

func (*Pipeline) Sort Uses

func (c *Pipeline) Sort(key string, sort Sort) *StringSliceCmd

func (*Pipeline) SortInterfaces Uses

func (c *Pipeline) SortInterfaces(key string, sort Sort) *SliceCmd

func (*Pipeline) StrLen Uses

func (c *Pipeline) StrLen(key string) *IntCmd

func (*Pipeline) Sync Uses

func (c *Pipeline) Sync()

func (*Pipeline) TTL Uses

func (c *Pipeline) TTL(key string) *DurationCmd

func (*Pipeline) Time Uses

func (c *Pipeline) Time() *TimeCmd

func (*Pipeline) Type Uses

func (c *Pipeline) Type(key string) *StatusCmd
func (c *Pipeline) Unlink(keys ...string) *IntCmd

func (*Pipeline) Wait Uses

func (c *Pipeline) Wait(numSlaves int, timeout time.Duration) *IntCmd

func (*Pipeline) ZAdd Uses

func (c *Pipeline) ZAdd(key string, members ...Z) *IntCmd

Redis `ZADD key score member [score member ...]` command.

func (*Pipeline) ZAddCh Uses

func (c *Pipeline) ZAddCh(key string, members ...Z) *IntCmd

Redis `ZADD key CH score member [score member ...]` command.

func (*Pipeline) ZAddNX Uses

func (c *Pipeline) ZAddNX(key string, members ...Z) *IntCmd

Redis `ZADD key NX score member [score member ...]` command.

func (*Pipeline) ZAddNXCh Uses

func (c *Pipeline) ZAddNXCh(key string, members ...Z) *IntCmd

Redis `ZADD key NX CH score member [score member ...]` command.

func (*Pipeline) ZAddXX Uses

func (c *Pipeline) ZAddXX(key string, members ...Z) *IntCmd

Redis `ZADD key XX score member [score member ...]` command.

func (*Pipeline) ZAddXXCh Uses

func (c *Pipeline) ZAddXXCh(key string, members ...Z) *IntCmd

Redis `ZADD key XX CH score member [score member ...]` command.

func (*Pipeline) ZCard Uses

func (c *Pipeline) ZCard(key string) *IntCmd

func (*Pipeline) ZCount Uses

func (c *Pipeline) ZCount(key, min, max string) *IntCmd

func (*Pipeline) ZIncr Uses

func (c *Pipeline) ZIncr(key string, member Z) *FloatCmd

Redis `ZADD key INCR score member` command.

func (*Pipeline) ZIncrBy Uses

func (c *Pipeline) ZIncrBy(key string, increment float64, member string) *FloatCmd

func (*Pipeline) ZIncrNX Uses

func (c *Pipeline) ZIncrNX(key string, member Z) *FloatCmd

Redis `ZADD key NX INCR score member` command.

func (*Pipeline) ZIncrXX Uses

func (c *Pipeline) ZIncrXX(key string, member Z) *FloatCmd

Redis `ZADD key XX INCR score member` command.

func (*Pipeline) ZInterStore Uses

func (c *Pipeline) ZInterStore(destination string, store ZStore, keys ...string) *IntCmd

func (*Pipeline) ZRange Uses

func (c *Pipeline) ZRange(key string, start, stop int64) *StringSliceCmd

func (*Pipeline) ZRangeByLex Uses

func (c *Pipeline) ZRangeByLex(key string, opt ZRangeBy) *StringSliceCmd

func (*Pipeline) ZRangeByScore Uses

func (c *Pipeline) ZRangeByScore(key string, opt ZRangeBy) *StringSliceCmd

func (*Pipeline) ZRangeByScoreWithScores Uses

func (c *Pipeline) ZRangeByScoreWithScores(key string, opt ZRangeBy) *ZSliceCmd

func (*Pipeline) ZRangeWithScores Uses

func (c *Pipeline) ZRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*Pipeline) ZRank Uses

func (c *Pipeline) ZRank(key, member string) *IntCmd

func (*Pipeline) ZRem Uses

func (c *Pipeline) ZRem(key string, members ...interface{}) *IntCmd

func (*Pipeline) ZRemRangeByLex Uses

func (c *Pipeline) ZRemRangeByLex(key, min, max string) *IntCmd

func (*Pipeline) ZRemRangeByRank Uses

func (c *Pipeline) ZRemRangeByRank(key string, start, stop int64) *IntCmd

func (*Pipeline) ZRemRangeByScore Uses

func (c *Pipeline) ZRemRangeByScore(key, min, max string) *IntCmd

func (*Pipeline) ZRevRange Uses

func (c *Pipeline) ZRevRange(key string, start, stop int64) *StringSliceCmd

func (*Pipeline) ZRevRangeByLex Uses

func (c *Pipeline) ZRevRangeByLex(key string, opt ZRangeBy) *StringSliceCmd

func (*Pipeline) ZRevRangeByScore Uses

func (c *Pipeline) ZRevRangeByScore(key string, opt ZRangeBy) *StringSliceCmd

func (*Pipeline) ZRevRangeByScoreWithScores Uses

func (c *Pipeline) ZRevRangeByScoreWithScores(key string, opt ZRangeBy) *ZSliceCmd

func (*Pipeline) ZRevRangeWithScores Uses

func (c *Pipeline) ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*Pipeline) ZRevRank Uses

func (c *Pipeline) ZRevRank(key, member string) *IntCmd

func (*Pipeline) ZScan Uses

func (c *Pipeline) ZScan(key string, cursor uint64, match string, count int64) *ScanCmd

func (*Pipeline) ZScore Uses

func (c *Pipeline) ZScore(key, member string) *FloatCmd

func (*Pipeline) ZUnionStore Uses

func (c *Pipeline) ZUnionStore(dest string, store ZStore, keys ...string) *IntCmd

type Pong Uses

type Pong struct {
    Payload string
}

Pong received as result of a PING command issued by another client.

func (*Pong) String Uses

func (p *Pong) String() string

type PoolStats Uses

type PoolStats struct {
    Requests uint32 // number of times a connection was requested by the pool
    Hits     uint32 // number of times free connection was found in the pool
    Timeouts uint32 // number of times a wait timeout occurred

    TotalConns uint32 // the number of total connections in the pool
    FreeConns  uint32 // the number of free connections in the pool
}

PoolStats contains pool state information and accumulated stats.

type PubSub Uses

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

PubSub implements Pub/Sub commands as described in http://redis.io/topics/pubsub. It's NOT safe for concurrent use by multiple goroutines.

Code:

pubsub, err := client.Subscribe("mychannel1")
if err != nil {
    panic(err)
}
defer pubsub.Close()

err = client.Publish("mychannel1", "hello").Err()
if err != nil {
    panic(err)
}

msg, err := pubsub.ReceiveMessage()
if err != nil {
    panic(err)
}

fmt.Println(msg.Channel, msg.Payload)

Output:

mychannel1 hello

func (*PubSub) Close Uses

func (c *PubSub) Close() error

func (*PubSub) PSubscribe Uses

func (c *PubSub) PSubscribe(patterns ...string) error

Subscribes the client to the given patterns.

func (*PubSub) PUnsubscribe Uses

func (c *PubSub) PUnsubscribe(patterns ...string) error

Unsubscribes the client from the given patterns, or from all of them if none is given.

func (*PubSub) Ping Uses

func (c *PubSub) Ping(payload ...string) error

func (*PubSub) Receive Uses

func (c *PubSub) Receive() (interface{}, error)

Receive returns a message as a Subscription, Message, Pong or error. See PubSub example for details. This is low-level API and most clients should use ReceiveMessage.

Code:

pubsub, err := client.Subscribe("mychannel2")
if err != nil {
    panic(err)
}
defer pubsub.Close()

n, err := client.Publish("mychannel2", "hello").Result()
if err != nil {
    panic(err)
}
fmt.Println(n, "clients received message")

for i := 0; i < 2; i++ {
    // ReceiveTimeout is a low level API. Use ReceiveMessage instead.
    msgi, err := pubsub.ReceiveTimeout(5 * time.Second)
    if err != nil {
        break
    }

    switch msg := msgi.(type) {
    case *redis.Subscription:
        fmt.Println("subscribed to", msg.Channel)
    case *redis.Message:
        fmt.Println("received", msg.Payload, "from", msg.Channel)
    default:
        panic(fmt.Errorf("unknown message: %#v", msgi))
    }
}

Output:

1 clients received message
subscribed to mychannel2
received hello from mychannel2

func (*PubSub) ReceiveMessage Uses

func (c *PubSub) ReceiveMessage() (*Message, error)

ReceiveMessage returns a Message or error ignoring Subscription or Pong messages. It automatically reconnects to Redis Server and resubscribes to channels in case of network errors.

func (*PubSub) ReceiveTimeout Uses

func (c *PubSub) ReceiveTimeout(timeout time.Duration) (interface{}, error)

ReceiveTimeout acts like Receive but returns an error if message is not received in time. This is low-level API and most clients should use ReceiveMessage.

func (*PubSub) Subscribe Uses

func (c *PubSub) Subscribe(channels ...string) error

Subscribes the client to the specified channels.

func (*PubSub) Unsubscribe Uses

func (c *PubSub) Unsubscribe(channels ...string) error

Unsubscribes the client from the given channels, or from all of them if none is given.

type Ring Uses

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

Ring is a Redis client that uses constistent hashing to distribute keys across multiple Redis servers (shards). It's safe for concurrent use by multiple goroutines.

Ring monitors the state of each shard and removes dead shards from the ring. When shard comes online it is added back to the ring. This gives you maximum availability and partition tolerance, but no consistency between different shards or even clients. Each client uses shards that are available to the client and does not do any coordination when shard state is changed.

Ring should be used when you need multiple Redis servers for caching and can tolerate losing data when one of the servers dies. Otherwise you should use Redis Cluster.

func NewRing Uses

func NewRing(opt *RingOptions) *Ring

Code:

client := redis.NewRing(&redis.RingOptions{
    Addrs: map[string]string{
        "shard1": ":7000",
        "shard2": ":7001",
        "shard3": ":7002",
    },
})
client.Ping()

func (*Ring) Append Uses

func (c *Ring) Append(key, value string) *IntCmd

func (*Ring) BLPop Uses

func (c *Ring) BLPop(timeout time.Duration, keys ...string) *StringSliceCmd

func (*Ring) BRPop Uses

func (c *Ring) BRPop(timeout time.Duration, keys ...string) *StringSliceCmd

func (*Ring) BRPopLPush Uses

func (c *Ring) BRPopLPush(source, destination string, timeout time.Duration) *StringCmd

func (*Ring) BgRewriteAOF Uses

func (c *Ring) BgRewriteAOF() *StatusCmd

func (*Ring) BgSave Uses

func (c *Ring) BgSave() *StatusCmd

func (*Ring) BitCount Uses

func (c *Ring) BitCount(key string, bitCount *BitCount) *IntCmd

func (*Ring) BitOpAnd Uses

func (c *Ring) BitOpAnd(destKey string, keys ...string) *IntCmd

func (*Ring) BitOpNot Uses

func (c *Ring) BitOpNot(destKey string, key string) *IntCmd

func (*Ring) BitOpOr Uses

func (c *Ring) BitOpOr(destKey string, keys ...string) *IntCmd

func (*Ring) BitOpXor Uses

func (c *Ring) BitOpXor(destKey string, keys ...string) *IntCmd

func (*Ring) BitPos Uses

func (c *Ring) BitPos(key string, bit int64, pos ...int64) *IntCmd

func (*Ring) ClientKill Uses

func (c *Ring) ClientKill(ipPort string) *StatusCmd

func (*Ring) ClientList Uses

func (c *Ring) ClientList() *StringCmd

func (*Ring) ClientPause Uses

func (c *Ring) ClientPause(dur time.Duration) *BoolCmd

func (*Ring) Close Uses

func (c *Ring) Close() error

Close closes the ring client, releasing any open resources.

It is rare to Close a Ring, as the Ring is meant to be long-lived and shared between many goroutines.

func (*Ring) ClusterAddSlots Uses

func (c *Ring) ClusterAddSlots(slots ...int) *StatusCmd

func (*Ring) ClusterAddSlotsRange Uses

func (c *Ring) ClusterAddSlotsRange(min, max int) *StatusCmd

func (*Ring) ClusterCountFailureReports Uses

func (c *Ring) ClusterCountFailureReports(nodeID string) *IntCmd

func (*Ring) ClusterCountKeysInSlot Uses

func (c *Ring) ClusterCountKeysInSlot(slot int) *IntCmd

func (*Ring) ClusterDelSlots Uses

func (c *Ring) ClusterDelSlots(slots ...int) *StatusCmd

func (*Ring) ClusterDelSlotsRange Uses

func (c *Ring) ClusterDelSlotsRange(min, max int) *StatusCmd

func (*Ring) ClusterFailover Uses

func (c *Ring) ClusterFailover() *StatusCmd

func (*Ring) ClusterForget Uses

func (c *Ring) ClusterForget(nodeID string) *StatusCmd

func (*Ring) ClusterInfo Uses

func (c *Ring) ClusterInfo() *StringCmd

func (*Ring) ClusterKeySlot Uses

func (c *Ring) ClusterKeySlot(key string) *IntCmd

func (*Ring) ClusterMeet Uses

func (c *Ring) ClusterMeet(host, port string) *StatusCmd

func (*Ring) ClusterNodes Uses

func (c *Ring) ClusterNodes() *StringCmd

func (*Ring) ClusterReplicate Uses

func (c *Ring) ClusterReplicate(nodeID string) *StatusCmd

func (*Ring) ClusterResetHard Uses

func (c *Ring) ClusterResetHard() *StatusCmd

func (*Ring) ClusterResetSoft Uses

func (c *Ring) ClusterResetSoft() *StatusCmd

func (*Ring) ClusterSaveConfig Uses

func (c *Ring) ClusterSaveConfig() *StatusCmd

func (*Ring) ClusterSlaves Uses

func (c *Ring) ClusterSlaves(nodeID string) *StringSliceCmd

func (*Ring) ClusterSlots Uses

func (c *Ring) ClusterSlots() *ClusterSlotsCmd

func (*Ring) Command Uses

func (c *Ring) Command() *CommandsInfoCmd

func (*Ring) ConfigGet Uses

func (c *Ring) ConfigGet(parameter string) *SliceCmd

func (*Ring) ConfigResetStat Uses

func (c *Ring) ConfigResetStat() *StatusCmd

func (*Ring) ConfigSet Uses

func (c *Ring) ConfigSet(parameter, value string) *StatusCmd

func (*Ring) DbSize Uses

func (c *Ring) DbSize() *IntCmd

func (*Ring) DebugObject Uses

func (c *Ring) DebugObject(key string) *StringCmd

func (*Ring) Decr Uses

func (c *Ring) Decr(key string) *IntCmd

func (*Ring) DecrBy Uses

func (c *Ring) DecrBy(key string, decrement int64) *IntCmd

func (*Ring) Del Uses

func (c *Ring) Del(keys ...string) *IntCmd

func (*Ring) Dump Uses

func (c *Ring) Dump(key string) *StringCmd

func (*Ring) Echo Uses

func (c *Ring) Echo(message interface{}) *StringCmd

func (*Ring) Eval Uses

func (c *Ring) Eval(script string, keys []string, args ...interface{}) *Cmd

func (*Ring) EvalSha Uses

func (c *Ring) EvalSha(sha1 string, keys []string, args ...interface{}) *Cmd

func (*Ring) Exists Uses

func (c *Ring) Exists(key string) *BoolCmd

func (*Ring) ExistsMulti Uses

func (c *Ring) ExistsMulti(keys ...string) *IntCmd

func (*Ring) Expire Uses

func (c *Ring) Expire(key string, expiration time.Duration) *BoolCmd

func (*Ring) ExpireAt Uses

func (c *Ring) ExpireAt(key string, tm time.Time) *BoolCmd

func (*Ring) FlushAll Uses

func (c *Ring) FlushAll() *StatusCmd

func (*Ring) FlushDb Uses

func (c *Ring) FlushDb() *StatusCmd

func (*Ring) ForEachShard Uses

func (c *Ring) ForEachShard(fn func(client *Client) error) error

ForEachShard concurrently calls the fn on each live shard in the ring. It returns the first error if any.

func (*Ring) GeoAdd Uses

func (c *Ring) GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd

func (*Ring) GeoDist Uses

func (c *Ring) GeoDist(key string, member1, member2, unit string) *FloatCmd

func (*Ring) GeoHash Uses

func (c *Ring) GeoHash(key string, members ...string) *StringSliceCmd

func (*Ring) GeoPos Uses

func (c *Ring) GeoPos(key string, members ...string) *GeoPosCmd

func (*Ring) GeoRadius Uses

func (c *Ring) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd

func (*Ring) GeoRadiusByMember Uses

func (c *Ring) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd

func (*Ring) Get Uses

func (c *Ring) Get(key string) *StringCmd

func (*Ring) GetBit Uses

func (c *Ring) GetBit(key string, offset int64) *IntCmd

func (*Ring) GetRange Uses

func (c *Ring) GetRange(key string, start, end int64) *StringCmd

func (*Ring) GetSet Uses

func (c *Ring) GetSet(key string, value interface{}) *StringCmd

func (*Ring) HDel Uses

func (c *Ring) HDel(key string, fields ...string) *IntCmd

func (*Ring) HExists Uses

func (c *Ring) HExists(key, field string) *BoolCmd

func (*Ring) HGet Uses

func (c *Ring) HGet(key, field string) *StringCmd

func (*Ring) HGetAll Uses

func (c *Ring) HGetAll(key string) *StringStringMapCmd

func (*Ring) HIncrBy Uses

func (c *Ring) HIncrBy(key, field string, incr int64) *IntCmd

func (*Ring) HIncrByFloat Uses

func (c *Ring) HIncrByFloat(key, field string, incr float64) *FloatCmd

func (*Ring) HKeys Uses

func (c *Ring) HKeys(key string) *StringSliceCmd

func (*Ring) HLen Uses

func (c *Ring) HLen(key string) *IntCmd

func (*Ring) HMGet Uses

func (c *Ring) HMGet(key string, fields ...string) *SliceCmd

func (*Ring) HMSet Uses

func (c *Ring) HMSet(key string, fields map[string]string) *StatusCmd

func (*Ring) HScan Uses

func (c *Ring) HScan(key string, cursor uint64, match string, count int64) *ScanCmd

func (*Ring) HSet Uses

func (c *Ring) HSet(key, field string, value interface{}) *BoolCmd

func (*Ring) HSetNX Uses

func (c *Ring) HSetNX(key, field string, value interface{}) *BoolCmd

func (*Ring) HVals Uses

func (c *Ring) HVals(key string) *StringSliceCmd

func (*Ring) Incr Uses

func (c *Ring) Incr(key string) *IntCmd

func (*Ring) IncrBy Uses

func (c *Ring) IncrBy(key string, value int64) *IntCmd

func (*Ring) IncrByFloat Uses

func (c *Ring) IncrByFloat(key string, value float64) *FloatCmd

func (*Ring) Info Uses

func (c *Ring) Info(section ...string) *StringCmd

func (*Ring) Keys Uses

func (c *Ring) Keys(pattern string) *StringSliceCmd

func (*Ring) LIndex Uses

func (c *Ring) LIndex(key string, index int64) *StringCmd

func (*Ring) LInsert Uses

func (c *Ring) LInsert(key, op string, pivot, value interface{}) *IntCmd

func (*Ring) LInsertAfter Uses

func (c *Ring) LInsertAfter(key string, pivot, value interface{}) *IntCmd

func (*Ring) LInsertBefore Uses

func (c *Ring) LInsertBefore(key string, pivot, value interface{}) *IntCmd

func (*Ring) LLen Uses

func (c *Ring) LLen(key string) *IntCmd

func (*Ring) LPop Uses

func (c *Ring) LPop(key string) *StringCmd

func (*Ring) LPush Uses

func (c *Ring) LPush(key string, values ...interface{}) *IntCmd

func (*Ring) LPushX Uses

func (c *Ring) LPushX(key string, value interface{}) *IntCmd

func (*Ring) LRange Uses

func (c *Ring) LRange(key string, start, stop int64) *StringSliceCmd

func (*Ring) LRem Uses

func (c *Ring) LRem(key string, count int64, value interface{}) *IntCmd

func (*Ring) LSet Uses

func (c *Ring) LSet(key string, index int64, value interface{}) *StatusCmd

func (*Ring) LTrim Uses

func (c *Ring) LTrim(key string, start, stop int64) *StatusCmd

func (*Ring) LastSave Uses

func (c *Ring) LastSave() *IntCmd

func (*Ring) MGet Uses

func (c *Ring) MGet(keys ...string) *SliceCmd

func (*Ring) MSet Uses

func (c *Ring) MSet(pairs ...interface{}) *StatusCmd

func (*Ring) MSetNX Uses

func (c *Ring) MSetNX(pairs ...interface{}) *BoolCmd

func (*Ring) Migrate Uses

func (c *Ring) Migrate(host, port, key string, db int64, timeout time.Duration) *StatusCmd

func (*Ring) Move Uses

func (c *Ring) Move(key string, db int64) *BoolCmd

func (*Ring) ObjectEncoding Uses

func (c *Ring) ObjectEncoding(key string) *StringCmd

func (*Ring) ObjectIdleTime Uses

func (c *Ring) ObjectIdleTime(key string) *DurationCmd

func (*Ring) ObjectRefCount Uses

func (c *Ring) ObjectRefCount(key string) *IntCmd

func (*Ring) PExpire Uses

func (c *Ring) PExpire(key string, expiration time.Duration) *BoolCmd

func (*Ring) PExpireAt Uses

func (c *Ring) PExpireAt(key string, tm time.Time) *BoolCmd

func (*Ring) PFAdd Uses

func (c *Ring) PFAdd(key string, els ...interface{}) *IntCmd

func (*Ring) PFCount Uses

func (c *Ring) PFCount(keys ...string) *IntCmd

func (*Ring) PFMerge Uses

func (c *Ring) PFMerge(dest string, keys ...string) *StatusCmd

func (*Ring) PTTL Uses

func (c *Ring) PTTL(key string) *DurationCmd

func (*Ring) Persist Uses

func (c *Ring) Persist(key string) *BoolCmd

func (*Ring) Ping Uses

func (c *Ring) Ping() *StatusCmd

func (*Ring) Pipeline Uses

func (c *Ring) Pipeline() *Pipeline

func (*Ring) Pipelined Uses

func (c *Ring) Pipelined(fn func(*Pipeline) error) ([]Cmder, error)

func (*Ring) PoolStats Uses

func (c *Ring) PoolStats() *PoolStats

PoolStats returns accumulated connection pool stats.

func (*Ring) Process Uses

func (c *Ring) Process(cmd Cmder) error

func (*Ring) PubSubChannels Uses

func (c *Ring) PubSubChannels(pattern string) *StringSliceCmd

func (*Ring) PubSubNumPat Uses

func (c *Ring) PubSubNumPat() *IntCmd

func (*Ring) PubSubNumSub Uses

func (c *Ring) PubSubNumSub(channels ...string) *StringIntMapCmd

func (*Ring) Publish Uses

func (c *Ring) Publish(channel, message string) *IntCmd

Publish posts the message to the channel.

func (*Ring) Quit Uses

func (c *Ring) Quit() *StatusCmd

func (*Ring) RPop Uses

func (c *Ring) RPop(key string) *StringCmd

func (*Ring) RPopLPush Uses

func (c *Ring) RPopLPush(source, destination string) *StringCmd

func (*Ring) RPush Uses

func (c *Ring) RPush(key string, values ...interface{}) *IntCmd

func (*Ring) RPushX Uses

func (c *Ring) RPushX(key string, value interface{}) *IntCmd

func (*Ring) RandomKey Uses

func (c *Ring) RandomKey() *StringCmd

func (*Ring) Rename Uses

func (c *Ring) Rename(key, newkey string) *StatusCmd

func (*Ring) RenameNX Uses

func (c *Ring) RenameNX(key, newkey string) *BoolCmd

func (*Ring) Restore Uses

func (c *Ring) Restore(key string, ttl time.Duration, value string) *StatusCmd

func (*Ring) RestoreReplace Uses

func (c *Ring) RestoreReplace(key string, ttl time.Duration, value string) *StatusCmd

func (*Ring) SAdd Uses

func (c *Ring) SAdd(key string, members ...interface{}) *IntCmd

func (*Ring) SCard Uses

func (c *Ring) SCard(key string) *IntCmd

func (*Ring) SDiff Uses

func (c *Ring) SDiff(keys ...string) *StringSliceCmd

func (*Ring) SDiffStore Uses

func (c *Ring) SDiffStore(destination string, keys ...string) *IntCmd

func (*Ring) SInter Uses

func (c *Ring) SInter(keys ...string) *StringSliceCmd

func (*Ring) SInterStore Uses

func (c *Ring) SInterStore(destination string, keys ...string) *IntCmd

func (*Ring) SIsMember Uses

func (c *Ring) SIsMember(key string, member interface{}) *BoolCmd

func (*Ring) SMembers Uses

func (c *Ring) SMembers(key string) *StringSliceCmd

func (*Ring) SMove Uses

func (c *Ring) SMove(source, destination string, member interface{}) *BoolCmd

func (*Ring) SPop Uses

func (c *Ring) SPop(key string) *StringCmd

Redis `SPOP key` command.

func (*Ring) SPopN Uses

func (c *Ring) SPopN(key string, count int64) *StringSliceCmd

Redis `SPOP key count` command.

func (*Ring) SRandMember Uses

func (c *Ring) SRandMember(key string) *StringCmd

Redis `SRANDMEMBER key` command.

func (*Ring) SRandMemberN Uses

func (c *Ring) SRandMemberN(key string, count int64) *StringSliceCmd

Redis `SRANDMEMBER key count` command.

func (*Ring) SRem Uses

func (c *Ring) SRem(key string, members ...interface{}) *IntCmd

func (*Ring) SScan Uses

func (c *Ring) SScan(key string, cursor uint64, match string, count int64) *ScanCmd

func (*Ring) SUnion Uses

func (c *Ring) SUnion(keys ...string) *StringSliceCmd

func (*Ring) SUnionStore Uses

func (c *Ring) SUnionStore(destination string, keys ...string) *IntCmd

func (*Ring) Save Uses

func (c *Ring) Save() *StatusCmd

func (*Ring) Scan Uses

func (c *Ring) Scan(cursor uint64, match string, count int64) *ScanCmd

func (*Ring) ScriptExists Uses

func (c *Ring) ScriptExists(scripts ...string) *BoolSliceCmd

func (*Ring) ScriptFlush Uses

func (c *Ring) ScriptFlush() *StatusCmd

func (*Ring) ScriptKill Uses

func (c *Ring) ScriptKill() *StatusCmd

func (*Ring) ScriptLoad Uses

func (c *Ring) ScriptLoad(script string) *StringCmd

func (*Ring) Set Uses

func (c *Ring) Set(key string, value interface{}, expiration time.Duration) *StatusCmd

Redis `SET key value [expiration]` command.

Use expiration for `SETEX`-like behavior. Zero expiration means the key has no expiration time.

func (*Ring) SetBit Uses

func (c *Ring) SetBit(key string, offset int64, value int) *IntCmd

func (*Ring) SetNX Uses

func (c *Ring) SetNX(key string, value interface{}, expiration time.Duration) *BoolCmd

Redis `SET key value [expiration] NX` command.

Zero expiration means the key has no expiration time.

func (*Ring) SetRange Uses

func (c *Ring) SetRange(key string, offset int64, value string) *IntCmd

func (*Ring) SetXX Uses

func (c *Ring) SetXX(key string, value interface{}, expiration time.Duration) *BoolCmd

Redis `SET key value [expiration] XX` command.

Zero expiration means the key has no expiration time.

func (*Ring) Shutdown Uses

func (c *Ring) Shutdown() *StatusCmd

func (*Ring) ShutdownNoSave Uses

func (c *Ring) ShutdownNoSave() *StatusCmd

func (*Ring) ShutdownSave Uses

func (c *Ring) ShutdownSave() *StatusCmd

func (*Ring) SlaveOf Uses

func (c *Ring) SlaveOf(host, port string) *StatusCmd

func (*Ring) SlowLog Uses

func (c *Ring) SlowLog()

func (*Ring) Sort Uses

func (c *Ring) Sort(key string, sort Sort) *StringSliceCmd

func (*Ring) SortInterfaces Uses

func (c *Ring) SortInterfaces(key string, sort Sort) *SliceCmd

func (*Ring) StrLen Uses

func (c *Ring) StrLen(key string) *IntCmd

func (*Ring) Sync Uses

func (c *Ring) Sync()

func (*Ring) TTL Uses

func (c *Ring) TTL(key string) *DurationCmd

func (*Ring) Time Uses

func (c *Ring) Time() *TimeCmd

func (*Ring) Type Uses

func (c *Ring) Type(key string) *StatusCmd
func (c *Ring) Unlink(keys ...string) *IntCmd

func (*Ring) Wait Uses

func (c *Ring) Wait(numSlaves int, timeout time.Duration) *IntCmd

func (*Ring) ZAdd Uses

func (c *Ring) ZAdd(key string, members ...Z) *IntCmd

Redis `ZADD key score member [score member ...]` command.

func (*Ring) ZAddCh Uses

func (c *Ring) ZAddCh(key string, members ...Z) *IntCmd

Redis `ZADD key CH score member [score member ...]` command.

func (*Ring) ZAddNX Uses

func (c *Ring) ZAddNX(key string, members ...Z) *IntCmd

Redis `ZADD key NX score member [score member ...]` command.

func (*Ring) ZAddNXCh Uses

func (c *Ring) ZAddNXCh(key string, members ...Z) *IntCmd

Redis `ZADD key NX CH score member [score member ...]` command.

func (*Ring) ZAddXX Uses

func (c *Ring) ZAddXX(key string, members ...Z) *IntCmd

Redis `ZADD key XX score member [score member ...]` command.

func (*Ring) ZAddXXCh Uses

func (c *Ring) ZAddXXCh(key string, members ...Z) *IntCmd

Redis `ZADD key XX CH score member [score member ...]` command.

func (*Ring) ZCard Uses

func (c *Ring) ZCard(key string) *IntCmd

func (*Ring) ZCount Uses

func (c *Ring) ZCount(key, min, max string) *IntCmd

func (*Ring) ZIncr Uses

func (c *Ring) ZIncr(key string, member Z) *FloatCmd

Redis `ZADD key INCR score member` command.

func (*Ring) ZIncrBy Uses

func (c *Ring) ZIncrBy(key string, increment float64, member string) *FloatCmd

func (*Ring) ZIncrNX Uses

func (c *Ring) ZIncrNX(key string, member Z) *FloatCmd

Redis `ZADD key NX INCR score member` command.

func (*Ring) ZIncrXX Uses

func (c *Ring) ZIncrXX(key string, member Z) *FloatCmd

Redis `ZADD key XX INCR score member` command.

func (*Ring) ZInterStore Uses

func (c *Ring) ZInterStore(destination string, store ZStore, keys ...string) *IntCmd

func (*Ring) ZRange Uses

func (c *Ring) ZRange(key string, start, stop int64) *StringSliceCmd

func (*Ring) ZRangeByLex Uses

func (c *Ring) ZRangeByLex(key string, opt ZRangeBy) *StringSliceCmd

func (*Ring) ZRangeByScore Uses

func (c *Ring) ZRangeByScore(key string, opt ZRangeBy) *StringSliceCmd

func (*Ring) ZRangeByScoreWithScores Uses

func (c *Ring) ZRangeByScoreWithScores(key string, opt ZRangeBy) *ZSliceCmd

func (*Ring) ZRangeWithScores Uses

func (c *Ring) ZRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*Ring) ZRank Uses

func (c *Ring) ZRank(key, member string) *IntCmd

func (*Ring) ZRem Uses

func (c *Ring) ZRem(key string, members ...interface{}) *IntCmd

func (*Ring) ZRemRangeByLex Uses

func (c *Ring) ZRemRangeByLex(key, min, max string) *IntCmd

func (*Ring) ZRemRangeByRank Uses

func (c *Ring) ZRemRangeByRank(key string, start, stop int64) *IntCmd

func (*Ring) ZRemRangeByScore Uses

func (c *Ring) ZRemRangeByScore(key, min, max string) *IntCmd

func (*Ring) ZRevRange Uses

func (c *Ring) ZRevRange(key string, start, stop int64) *StringSliceCmd

func (*Ring) ZRevRangeByLex Uses

func (c *Ring) ZRevRangeByLex(key string, opt ZRangeBy) *StringSliceCmd

func (*Ring) ZRevRangeByScore Uses

func (c *Ring) ZRevRangeByScore(key string, opt ZRangeBy) *StringSliceCmd

func (*Ring) ZRevRangeByScoreWithScores Uses

func (c *Ring) ZRevRangeByScoreWithScores(key string, opt ZRangeBy) *ZSliceCmd

func (*Ring) ZRevRangeWithScores Uses

func (c *Ring) ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*Ring) ZRevRank Uses

func (c *Ring) ZRevRank(key, member string) *IntCmd

func (*Ring) ZScan Uses

func (c *Ring) ZScan(key string, cursor uint64, match string, count int64) *ScanCmd

func (*Ring) ZScore Uses

func (c *Ring) ZScore(key, member string) *FloatCmd

func (*Ring) ZUnionStore Uses

func (c *Ring) ZUnionStore(dest string, store ZStore, keys ...string) *IntCmd

type RingOptions Uses

type RingOptions struct {
    // Map of name => host:port addresses of ring shards.
    Addrs map[string]string

    // Frequency of PING commands sent to check shards availability.
    // Shard is considered down after 3 subsequent failed checks.
    HeartbeatFrequency time.Duration

    DB       int
    Password string

    MaxRetries int

    DialTimeout  time.Duration
    ReadTimeout  time.Duration
    WriteTimeout time.Duration

    PoolSize           int
    PoolTimeout        time.Duration
    IdleTimeout        time.Duration
    IdleCheckFrequency time.Duration
}

RingOptions are used to configure a ring client and should be passed to NewRing.

type ScanCmd Uses

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

func NewScanCmd Uses

func NewScanCmd(process func(cmd Cmder) error, args ...interface{}) *ScanCmd

func NewScanCmdResult Uses

func NewScanCmdResult(keys []string, cursor uint64, err error) *ScanCmd

NewScanCmdResult returns a ScanCmd initalised with val and err for testing

func (*ScanCmd) Err Uses

func (cmd *ScanCmd) Err() error

func (*ScanCmd) Iterator Uses

func (cmd *ScanCmd) Iterator() *ScanIterator

Iterator creates a new ScanIterator.

Code:

iter := client.Scan(0, "", 0).Iterator()
for iter.Next() {
    fmt.Println(iter.Val())
}
if err := iter.Err(); err != nil {
    panic(err)
}

func (*ScanCmd) Result Uses

func (cmd *ScanCmd) Result() (keys []string, cursor uint64, err error)

func (*ScanCmd) String Uses

func (cmd *ScanCmd) String() string

func (*ScanCmd) Val Uses

func (cmd *ScanCmd) Val() (keys []string, cursor uint64)

type ScanIterator Uses

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

ScanIterator is used to incrementally iterate over a collection of elements. It's safe for concurrent use by multiple goroutines.

Code:

iter := client.Scan(0, "", 0).Iterator()
for iter.Next() {
    fmt.Println(iter.Val())
}
if err := iter.Err(); err != nil {
    panic(err)
}

func (*ScanIterator) Err Uses

func (it *ScanIterator) Err() error

Err returns the last iterator error, if any.

func (*ScanIterator) Next Uses

func (it *ScanIterator) Next() bool

Next advances the cursor and returns true if more values can be read.

func (*ScanIterator) Val Uses

func (it *ScanIterator) Val() string

Val returns the key/field at the current cursor position.

type Script Uses

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

Code:

IncrByXX := redis.NewScript(`
		if redis.call("GET", KEYS[1]) ~= false then
			return redis.call("INCRBY", KEYS[1], ARGV[1])
		end
		return false
	`)

n, err := IncrByXX.Run(client, []string{"xx_counter"}, 2).Result()
fmt.Println(n, err)

err = client.Set("xx_counter", "40", 0).Err()
if err != nil {
    panic(err)
}

n, err = IncrByXX.Run(client, []string{"xx_counter"}, 2).Result()
fmt.Println(n, err)

Output:

<nil> redis: nil
42 <nil>

func NewScript Uses

func NewScript(src string) *Script

func (*Script) Eval Uses

func (s *Script) Eval(c scripter, keys []string, args ...interface{}) *Cmd

func (*Script) EvalSha Uses

func (s *Script) EvalSha(c scripter, keys []string, args ...interface{}) *Cmd

func (*Script) Exists Uses

func (s *Script) Exists(c scripter) *BoolSliceCmd

func (*Script) Load Uses

func (s *Script) Load(c scripter) *StringCmd

func (*Script) Run Uses

func (s *Script) Run(c scripter, keys []string, args ...interface{}) *Cmd

type SliceCmd Uses

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

func NewSliceCmd Uses

func NewSliceCmd(args ...interface{}) *SliceCmd

func NewSliceResult Uses

func NewSliceResult(val []interface{}, err error) *SliceCmd

NewSliceResult returns a SliceCmd initalised with val and err for testing

func (*SliceCmd) Err Uses

func (cmd *SliceCmd) Err() error

func (*SliceCmd) Result Uses

func (cmd *SliceCmd) Result() ([]interface{}, error)

func (*SliceCmd) String Uses

func (cmd *SliceCmd) String() string

func (*SliceCmd) Val Uses

func (cmd *SliceCmd) Val() []interface{}

type Sort Uses

type Sort struct {
    By            string
    Offset, Count float64
    Get           []string
    Order         string
    IsAlpha       bool
    Store         string
}

type StatusCmd Uses

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

func NewStatusCmd Uses

func NewStatusCmd(args ...interface{}) *StatusCmd

func NewStatusResult Uses

func NewStatusResult(val string, err error) *StatusCmd

NewStatusResult returns a StatusCmd initalised with val and err for testing

func (*StatusCmd) Err Uses

func (cmd *StatusCmd) Err() error

func (*StatusCmd) Result Uses

func (cmd *StatusCmd) Result() (string, error)

func (*StatusCmd) String Uses

func (cmd *StatusCmd) String() string

func (*StatusCmd) Val Uses

func (cmd *StatusCmd) Val() string

type StringCmd Uses

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

func NewStringCmd Uses

func NewStringCmd(args ...interface{}) *StringCmd

func NewStringResult Uses

func NewStringResult(val string, err error) *StringCmd

NewStringResult returns a StringCmd initalised with val and err for testing

func (*StringCmd) Bytes Uses

func (cmd *StringCmd) Bytes() ([]byte, error)

func (*StringCmd) Err Uses

func (cmd *StringCmd) Err() error

func (*StringCmd) Float64 Uses

func (cmd *StringCmd) Float64() (float64, error)

func (*StringCmd) Int64 Uses

func (cmd *StringCmd) Int64() (int64, error)

func (*StringCmd) Result Uses

func (cmd *StringCmd) Result() (string, error)

func (*StringCmd) Scan Uses

func (cmd *StringCmd) Scan(val interface{}) error

func (*StringCmd) String Uses

func (cmd *StringCmd) String() string

func (*StringCmd) Uint64 Uses

func (cmd *StringCmd) Uint64() (uint64, error)

func (*StringCmd) Val Uses

func (cmd *StringCmd) Val() string

type StringIntMapCmd Uses

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

func NewStringIntMapCmd Uses

func NewStringIntMapCmd(args ...interface{}) *StringIntMapCmd

func NewStringIntMapCmdResult Uses

func NewStringIntMapCmdResult(val map[string]int64, err error) *StringIntMapCmd

NewStringIntMapCmdResult returns a StringIntMapCmd initalised with val and err for testing

func (*StringIntMapCmd) Err Uses

func (cmd *StringIntMapCmd) Err() error

func (*StringIntMapCmd) Result Uses

func (cmd *StringIntMapCmd) Result() (map[string]int64, error)

func (*StringIntMapCmd) String Uses

func (cmd *StringIntMapCmd) String() string

func (*StringIntMapCmd) Val Uses

func (cmd *StringIntMapCmd) Val() map[string]int64

type StringSliceCmd Uses

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

func NewStringSliceCmd Uses

func NewStringSliceCmd(args ...interface{}) *StringSliceCmd

func NewStringSliceResult Uses

func NewStringSliceResult(val []string, err error) *StringSliceCmd

NewStringSliceResult returns a StringSliceCmd initalised with val and err for testing

func (*StringSliceCmd) Err Uses

func (cmd *StringSliceCmd) Err() error

func (*StringSliceCmd) Result Uses

func (cmd *StringSliceCmd) Result() ([]string, error)

func (*StringSliceCmd) ScanSlice Uses

func (cmd *StringSliceCmd) ScanSlice(container interface{}) error

func (*StringSliceCmd) String Uses

func (cmd *StringSliceCmd) String() string

func (*StringSliceCmd) Val Uses

func (cmd *StringSliceCmd) Val() []string

type StringStringMapCmd Uses

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

func NewStringStringMapCmd Uses

func NewStringStringMapCmd(args ...interface{}) *StringStringMapCmd

func NewStringStringMapResult Uses

func NewStringStringMapResult(val map[string]string, err error) *StringStringMapCmd

NewStringStringMapResult returns a StringStringMapCmd initalised with val and err for testing

func (*StringStringMapCmd) Err Uses

func (cmd *StringStringMapCmd) Err() error

func (*StringStringMapCmd) Result Uses

func (cmd *StringStringMapCmd) Result() (map[string]string, error)

func (*StringStringMapCmd) String Uses

func (cmd *StringStringMapCmd) String() string

func (*StringStringMapCmd) Val Uses

func (cmd *StringStringMapCmd) Val() map[string]string

type Subscription Uses

type Subscription struct {
    // Can be "subscribe", "unsubscribe", "psubscribe" or "punsubscribe".
    Kind string
    // Channel name we have subscribed to.
    Channel string
    // Number of channels we are currently subscribed to.
    Count int
}

Message received after a successful subscription to channel.

func (*Subscription) String Uses

func (m *Subscription) String() string

type TimeCmd Uses

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

func NewTimeCmd Uses

func NewTimeCmd(args ...interface{}) *TimeCmd

func (*TimeCmd) Err Uses

func (cmd *TimeCmd) Err() error

func (*TimeCmd) Result Uses

func (cmd *TimeCmd) Result() (time.Time, error)

func (*TimeCmd) String Uses

func (cmd *TimeCmd) String() string

func (*TimeCmd) Val Uses

func (cmd *TimeCmd) Val() time.Time

type Tx Uses

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

Tx implements Redis transactions as described in http://redis.io/topics/transactions. It's NOT safe for concurrent use by multiple goroutines, because Exec resets list of watched keys. If you don't need WATCH it is better to use Pipeline.

func (*Tx) Append Uses

func (c *Tx) Append(key, value string) *IntCmd

func (*Tx) Auth Uses

func (c *Tx) Auth(password string) *StatusCmd

func (*Tx) BLPop Uses

func (c *Tx) BLPop(timeout time.Duration, keys ...string) *StringSliceCmd

func (*Tx) BRPop Uses

func (c *Tx) BRPop(timeout time.Duration, keys ...string) *StringSliceCmd

func (*Tx) BRPopLPush Uses

func (c *Tx) BRPopLPush(source, destination string, timeout time.Duration) *StringCmd

func (*Tx) BgRewriteAOF Uses

func (c *Tx) BgRewriteAOF() *StatusCmd

func (*Tx) BgSave Uses

func (c *Tx) BgSave() *StatusCmd

func (*Tx) BitCount Uses

func (c *Tx) BitCount(key string, bitCount *BitCount) *IntCmd

func (*Tx) BitOpAnd Uses

func (c *Tx) BitOpAnd(destKey string, keys ...string) *IntCmd

func (*Tx) BitOpNot Uses

func (c *Tx) BitOpNot(destKey string, key string) *IntCmd

func (*Tx) BitOpOr Uses

func (c *Tx) BitOpOr(destKey string, keys ...string) *IntCmd

func (*Tx) BitOpXor Uses

func (c *Tx) BitOpXor(destKey string, keys ...string) *IntCmd

func (*Tx) BitPos Uses

func (c *Tx) BitPos(key string, bit int64, pos ...int64) *IntCmd

func (*Tx) ClientGetName Uses

func (c *Tx) ClientGetName() *StringCmd

ClientGetName returns the name of the connection.

func (*Tx) ClientKill Uses

func (c *Tx) ClientKill(ipPort string) *StatusCmd

func (*Tx) ClientList Uses

func (c *Tx) ClientList() *StringCmd

func (*Tx) ClientPause Uses

func (c *Tx) ClientPause(dur time.Duration) *BoolCmd

func (*Tx) ClientSetName Uses

func (c *Tx) ClientSetName(name string) *BoolCmd

ClientSetName assigns a name to the connection.

func (*Tx) Close Uses

func (c *Tx) Close() error

close closes the transaction, releasing any open resources.

func (*Tx) ClusterAddSlots Uses

func (c *Tx) ClusterAddSlots(slots ...int) *StatusCmd

func (*Tx) ClusterAddSlotsRange Uses

func (c *Tx) ClusterAddSlotsRange(min, max int) *StatusCmd

func (*Tx) ClusterCountFailureReports Uses

func (c *Tx) ClusterCountFailureReports(nodeID string) *IntCmd

func (*Tx) ClusterCountKeysInSlot Uses

func (c *Tx) ClusterCountKeysInSlot(slot int) *IntCmd

func (*Tx) ClusterDelSlots Uses

func (c *Tx) ClusterDelSlots(slots ...int) *StatusCmd

func (*Tx) ClusterDelSlotsRange Uses

func (c *Tx) ClusterDelSlotsRange(min, max int) *StatusCmd

func (*Tx) ClusterFailover Uses

func (c *Tx) ClusterFailover() *StatusCmd

func (*Tx) ClusterForget Uses

func (c *Tx) ClusterForget(nodeID string) *StatusCmd

func (*Tx) ClusterInfo Uses

func (c *Tx) ClusterInfo() *StringCmd

func (*Tx) ClusterKeySlot Uses

func (c *Tx) ClusterKeySlot(key string) *IntCmd

func (*Tx) ClusterMeet Uses

func (c *Tx) ClusterMeet(host, port string) *StatusCmd

func (*Tx) ClusterNodes Uses

func (c *Tx) ClusterNodes() *StringCmd

func (*Tx) ClusterReplicate Uses

func (c *Tx) ClusterReplicate(nodeID string) *StatusCmd

func (*Tx) ClusterResetHard Uses

func (c *Tx) ClusterResetHard() *StatusCmd

func (*Tx) ClusterResetSoft Uses

func (c *Tx) ClusterResetSoft() *StatusCmd

func (*Tx) ClusterSaveConfig Uses

func (c *Tx) ClusterSaveConfig() *StatusCmd

func (*Tx) ClusterSlaves Uses

func (c *Tx) ClusterSlaves(nodeID string) *StringSliceCmd

func (*Tx) ClusterSlots Uses

func (c *Tx) ClusterSlots() *ClusterSlotsCmd

func (*Tx) Command Uses

func (c *Tx) Command() *CommandsInfoCmd

func (*Tx) ConfigGet Uses

func (c *Tx) ConfigGet(parameter string) *SliceCmd

func (*Tx) ConfigResetStat Uses

func (c *Tx) ConfigResetStat() *StatusCmd

func (*Tx) ConfigSet Uses

func (c *Tx) ConfigSet(parameter, value string) *StatusCmd

func (*Tx) DbSize Uses

func (c *Tx) DbSize() *IntCmd

func (*Tx) DebugObject Uses

func (c *Tx) DebugObject(key string) *StringCmd

func (*Tx) Decr Uses

func (c *Tx) Decr(key string) *IntCmd

func (*Tx) DecrBy Uses

func (c *Tx) DecrBy(key string, decrement int64) *IntCmd

func (*Tx) Del Uses

func (c *Tx) Del(keys ...string) *IntCmd

func (*Tx) Dump Uses

func (c *Tx) Dump(key string) *StringCmd

func (*Tx) Echo Uses

func (c *Tx) Echo(message interface{}) *StringCmd

func (*Tx) Eval Uses

func (c *Tx) Eval(script string, keys []string, args ...interface{}) *Cmd

func (*Tx) EvalSha Uses

func (c *Tx) EvalSha(sha1 string, keys []string, args ...interface{}) *Cmd

func (*Tx) Exists Uses

func (c *Tx) Exists(key string) *BoolCmd

func (*Tx) ExistsMulti Uses

func (c *Tx) ExistsMulti(keys ...string) *IntCmd

func (*Tx) Expire Uses

func (c *Tx) Expire(key string, expiration time.Duration) *BoolCmd

func (*Tx) ExpireAt Uses

func (c *Tx) ExpireAt(key string, tm time.Time) *BoolCmd

func (*Tx) FlushAll Uses

func (c *Tx) FlushAll() *StatusCmd

func (*Tx) FlushDb Uses

func (c *Tx) FlushDb() *StatusCmd

func (*Tx) GeoAdd Uses

func (c *Tx) GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd

func (*Tx) GeoDist Uses

func (c *Tx) GeoDist(key string, member1, member2, unit string) *FloatCmd

func (*Tx) GeoHash Uses

func (c *Tx) GeoHash(key string, members ...string) *StringSliceCmd

func (*Tx) GeoPos Uses

func (c *Tx) GeoPos(key string, members ...string) *GeoPosCmd

func (*Tx) GeoRadius Uses

func (c *Tx) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd

func (*Tx) GeoRadiusByMember Uses

func (c *Tx) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd

func (*Tx) Get Uses

func (c *Tx) Get(key string) *StringCmd

func (*Tx) GetBit Uses

func (c *Tx) GetBit(key string, offset int64) *IntCmd

func (*Tx) GetRange Uses

func (c *Tx) GetRange(key string, start, end int64) *StringCmd

func (*Tx) GetSet Uses

func (c *Tx) GetSet(key string, value interface{}) *StringCmd

func (*Tx) HDel Uses

func (c *Tx) HDel(key string, fields ...string) *IntCmd

func (*Tx) HExists Uses

func (c *Tx) HExists(key, field string) *BoolCmd

func (*Tx) HGet Uses

func (c *Tx) HGet(key, field string) *StringCmd

func (*Tx) HGetAll Uses

func (c *Tx) HGetAll(key string) *StringStringMapCmd

func (*Tx) HIncrBy Uses

func (c *Tx) HIncrBy(key, field string, incr int64) *IntCmd

func (*Tx) HIncrByFloat Uses

func (c *Tx) HIncrByFloat(key, field string, incr float64) *FloatCmd

func (*Tx) HKeys Uses

func (c *Tx) HKeys(key string) *StringSliceCmd

func (*Tx) HLen Uses

func (c *Tx) HLen(key string) *IntCmd

func (*Tx) HMGet Uses

func (c *Tx) HMGet(key string, fields ...string) *SliceCmd

func (*Tx) HMSet Uses

func (c *Tx) HMSet(key string, fields map[string]string) *StatusCmd

func (*Tx) HScan Uses

func (c *Tx) HScan(key string, cursor uint64, match string, count int64) *ScanCmd

func (*Tx) HSet Uses

func (c *Tx) HSet(key, field string, value interface{}) *BoolCmd

func (*Tx) HSetNX Uses

func (c *Tx) HSetNX(key, field string, value interface{}) *BoolCmd

func (*Tx) HVals Uses

func (c *Tx) HVals(key string) *StringSliceCmd

func (*Tx) Incr Uses

func (c *Tx) Incr(key string) *IntCmd

func (*Tx) IncrBy Uses

func (c *Tx) IncrBy(key string, value int64) *IntCmd

func (*Tx) IncrByFloat Uses

func (c *Tx) IncrByFloat(key string, value float64) *FloatCmd

func (*Tx) Info Uses

func (c *Tx) Info(section ...string) *StringCmd

func (*Tx) Keys Uses

func (c *Tx) Keys(pattern string) *StringSliceCmd

func (*Tx) LIndex Uses

func (c *Tx) LIndex(key string, index int64) *StringCmd

func (*Tx) LInsert Uses

func (c *Tx) LInsert(key, op string, pivot, value interface{}) *IntCmd

func (*Tx) LInsertAfter Uses

func (c *Tx) LInsertAfter(key string, pivot, value interface{}) *IntCmd

func (*Tx) LInsertBefore Uses

func (c *Tx) LInsertBefore(key string, pivot, value interface{}) *IntCmd

func (*Tx) LLen Uses

func (c *Tx) LLen(key string) *IntCmd

func (*Tx) LPop Uses

func (c *Tx) LPop(key string) *StringCmd

func (*Tx) LPush Uses

func (c *Tx) LPush(key string, values ...interface{}) *IntCmd

func (*Tx) LPushX Uses

func (c *Tx) LPushX(key string, value interface{}) *IntCmd

func (*Tx) LRange Uses

func (c *Tx) LRange(key string, start, stop int64) *StringSliceCmd

func (*Tx) LRem Uses

func (c *Tx) LRem(key string, count int64, value interface{}) *IntCmd

func (*Tx) LSet Uses

func (c *Tx) LSet(key string, index int64, value interface{}) *StatusCmd

func (*Tx) LTrim Uses

func (c *Tx) LTrim(key string, start, stop int64) *StatusCmd

func (*Tx) LastSave Uses

func (c *Tx) LastSave() *IntCmd

func (*Tx) MGet Uses

func (c *Tx) MGet(keys ...string) *SliceCmd

func (*Tx) MSet Uses

func (c *Tx) MSet(pairs ...interface{}) *StatusCmd

func (*Tx) MSetNX Uses

func (c *Tx) MSetNX(pairs ...interface{}) *BoolCmd

func (*Tx) Migrate Uses

func (c *Tx) Migrate(host, port, key string, db int64, timeout time.Duration) *StatusCmd

func (*Tx) Move Uses

func (c *Tx) Move(key string, db int64) *BoolCmd

func (*Tx) ObjectEncoding Uses

func (c *Tx) ObjectEncoding(key string) *StringCmd

func (*Tx) ObjectIdleTime Uses

func (c *Tx) ObjectIdleTime(key string) *DurationCmd

func (*Tx) ObjectRefCount Uses

func (c *Tx) ObjectRefCount(key string) *IntCmd

func (*Tx) PExpire Uses

func (c *Tx) PExpire(key string, expiration time.Duration) *BoolCmd

func (*Tx) PExpireAt Uses

func (c *Tx) PExpireAt(key string, tm time.Time) *BoolCmd

func (*Tx) PFAdd Uses

func (c *Tx) PFAdd(key string, els ...interface{}) *IntCmd

func (*Tx) PFCount Uses

func (c *Tx) PFCount(keys ...string) *IntCmd

func (*Tx) PFMerge Uses

func (c *Tx) PFMerge(dest string, keys ...string) *StatusCmd

func (*Tx) PTTL Uses

func (c *Tx) PTTL(key string) *DurationCmd

func (*Tx) Persist Uses

func (c *Tx) Persist(key string) *BoolCmd

func (*Tx) Ping Uses

func (c *Tx) Ping() *StatusCmd

func (*Tx) Pipeline Uses

func (c *Tx) Pipeline() *Pipeline

func (*Tx) Pipelined Uses

func (c *Tx) Pipelined(fn func(*Pipeline) error) ([]Cmder, error)

Pipelined executes commands queued in the fn in a transaction and restores the connection state to normal.

When using WATCH, EXEC will execute commands only if the watched keys were not modified, allowing for a check-and-set mechanism.

Exec always returns list of commands. If transaction fails TxFailedErr is returned. Otherwise Exec returns error of the first failed command or nil.

func (*Tx) Process Uses

func (c *Tx) Process(cmd Cmder) error

func (*Tx) PubSubChannels Uses

func (c *Tx) PubSubChannels(pattern string) *StringSliceCmd

func (*Tx) PubSubNumPat Uses

func (c *Tx) PubSubNumPat() *IntCmd

func (*Tx) PubSubNumSub Uses

func (c *Tx) PubSubNumSub(channels ...string) *StringIntMapCmd

func (*Tx) Publish Uses

func (c *Tx) Publish(channel, message string) *IntCmd

Publish posts the message to the channel.

func (*Tx) Quit Uses

func (c *Tx) Quit() *StatusCmd

func (*Tx) RPop Uses

func (c *Tx) RPop(key string) *StringCmd

func (*Tx) RPopLPush Uses

func (c *Tx) RPopLPush(source, destination string) *StringCmd

func (*Tx) RPush Uses

func (c *Tx) RPush(key string, values ...interface{}) *IntCmd

func (*Tx) RPushX Uses

func (c *Tx) RPushX(key string, value interface{}) *IntCmd

func (*Tx) RandomKey Uses

func (c *Tx) RandomKey() *StringCmd

func (*Tx) ReadOnly Uses

func (c *Tx) ReadOnly() *StatusCmd

func (*Tx) ReadWrite Uses

func (c *Tx) ReadWrite() *StatusCmd

func (*Tx) Rename Uses

func (c *Tx) Rename(key, newkey string) *StatusCmd

func (*Tx) RenameNX Uses

func (c *Tx) RenameNX(key, newkey string) *BoolCmd

func (*Tx) Restore Uses

func (c *Tx) Restore(key string, ttl time.Duration, value string) *StatusCmd

func (*Tx) RestoreReplace Uses

func (c *Tx) RestoreReplace(key string, ttl time.Duration, value string) *StatusCmd

func (*Tx) SAdd Uses

func (c *Tx) SAdd(key string, members ...interface{}) *IntCmd

func (*Tx) SCard Uses

func (c *Tx) SCard(key string) *IntCmd

func (*Tx) SDiff Uses

func (c *Tx) SDiff(keys ...string) *StringSliceCmd

func (*Tx) SDiffStore Uses

func (c *Tx) SDiffStore(destination string, keys ...string) *IntCmd

func (*Tx) SInter Uses

func (c *Tx) SInter(keys ...string) *StringSliceCmd

func (*Tx) SInterStore Uses

func (c *Tx) SInterStore(destination string, keys ...string) *IntCmd

func (*Tx) SIsMember Uses

func (c *Tx) SIsMember(key string, member interface{}) *BoolCmd

func (*Tx) SMembers Uses

func (c *Tx) SMembers(key string) *StringSliceCmd

func (*Tx) SMove Uses

func (c *Tx) SMove(source, destination string, member interface{}) *BoolCmd

func (*Tx) SPop Uses

func (c *Tx) SPop(key string) *StringCmd

Redis `SPOP key` command.

func (*Tx) SPopN Uses

func (c *Tx) SPopN(key string, count int64) *StringSliceCmd

Redis `SPOP key count` command.

func (*Tx) SRandMember Uses

func (c *Tx) SRandMember(key string) *StringCmd

Redis `SRANDMEMBER key` command.

func (*Tx) SRandMemberN Uses

func (c *Tx) SRandMemberN(key string, count int64) *StringSliceCmd

Redis `SRANDMEMBER key count` command.

func (*Tx) SRem Uses

func (c *Tx) SRem(key string, members ...interface{}) *IntCmd

func (*Tx) SScan Uses

func (c *Tx) SScan(key string, cursor uint64, match string, count int64) *ScanCmd

func (*Tx) SUnion Uses

func (c *Tx) SUnion(keys ...string) *StringSliceCmd

func (*Tx) SUnionStore Uses

func (c *Tx) SUnionStore(destination string, keys ...string) *IntCmd

func (*Tx) Save Uses

func (c *Tx) Save() *StatusCmd

func (*Tx) Scan Uses

func (c *Tx) Scan(cursor uint64, match string, count int64) *ScanCmd

func (*Tx) ScriptExists Uses

func (c *Tx) ScriptExists(scripts ...string) *BoolSliceCmd

func (*Tx) ScriptFlush Uses

func (c *Tx) ScriptFlush() *StatusCmd

func (*Tx) ScriptKill Uses

func (c *Tx) ScriptKill() *StatusCmd