redisClient

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

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

Go to latest
Published: Jul 14, 2019 License: MIT Imports: 10 Imported by: 1

README

go-redis-client

Client for cluster and stand-alone versions of redis written in go

The main motivation is to have a simple client that is transparent to the application independently of being a stand-alone or cluster client

Features
  • Automatic key prefix
  • Unified options object when creating client instance
  • Uses github.com/go-redis/redis client internally: currently using gopkg.in/redis.v5
  • Client interface for usage
  • About usage in Container README.en.md or README.zh.md
Example
package main

import "redis" github.com/alauda/go-redis-client

func main() {
  // check options.go for more details
  opts := redis.RedisClientOptions{
    Type: 	  redis.ClientNormal,
    Hosts:    []string{"localhost:6379"},
    Password: "123456",
    Database: 0,
  }
  client := redis.NewRedisClient(opts)
  if err := client.Ping().Err(); err != nil {
    panic(err)
  }
  
  // Using cluster mode
  clusterOpts := redis.RedisClientOptions{
    Type:      redis.ClientCluster,
    Hosts:     []string{"localhost:7000","localhost:7001","localhost:7002"},
    Password:  "123456",
    Database:  0,
    // all keys with a prefix
    KeyPrefix: "my-app:",
  }
  clusterClient := redis.NewRedisClient(clusterOpts)
  if err := clusterClient.Ping().Err(); err != nil {
    panic(err)
  }
}
Supported commands
  • MGetByPipeline
  • Ping
  • Incr
  • IncrBy
  • Decr
  • DecrBy
  • Expire
  • ExpireAt
  • Persist
  • PExpire
  • PExpireAt
  • PTTL
  • TTL
  • Exists
  • Get
  • GetBit
  • GetRange
  • GetSet
  • MGet
  • Dump
  • HExists
  • HGet
  • HGetAll
  • HIncrBy
  • HIncrByFloat
  • HKeys
  • HLen
  • HMGet
  • HMSet
  • HSet
  • HSetNX
  • HVals
  • LIndex
  • LInsert
  • LInsertAfter
  • LInsertBefore
  • LLen
  • LPop
  • LPush
  • LPushX
  • LRange
  • lRem
  • LSet
  • LTrim
  • RPop
  • RPopLPush
  • RPush
  • RPushX
  • Set
  • Append
  • Del
  • Unlink
  • SAdd
  • SCard
  • SDiff
  • SDiffStore
  • SInter
  • SInterStore
  • SIsMember
  • SMembers
  • SMove
  • SPop
  • SPopN
  • SRandMember
  • SRem
  • SUnion
  • SUnionStore
  • ZAdd
  • ZAddNX
  • ZAddXX
  • ZAddCh
  • ZaddNXCh
  • ZIncr
  • ZIncrNX
  • ZIncrXX
  • ZCard
  • ZCount
  • ZIncrBy
  • ZInterStore
  • ZRange
  • ZRangeWithScores
  • ZRangeByScore
  • ZRangeByLex
  • ZRangeByScoreWithScores
  • ZRank
  • ZRem
  • ZREmRangeByRank
  • ZRemRangeByScore
  • ZRemRangeByLex
  • ZRevRange
  • ZRevRangeWithScores
  • ZRevRangeByScore
  • ZRevRangeByLex
  • ZRevRangeByScoreWithScores
  • ZRevRank
  • ZScore
  • ZUnionStore
  • BLPop
  • BRPop
  • BRPopLPush
  • Type
  • Scan
  • SScan
  • ZScan
  • HScan
  • Publish
  • Subscribe
TODO
  • Update to redis.v6
  • Support RedisCluster Subscribe
  • Better support for godoc
  • Add docker-compose and example application
  • Add tests

Documentation

Index

Constants

View Source
const RedisNil = redis.Nil

RedisNil means nil reply, .e.g. when key does not exist.

Variables

View Source
var ErrNotImplemented = errors.New("Not implemented")

ErrNotImplemented not implemented error

Functions

This section is empty.

Types

type BlockedSettable

type BlockedSettable interface {
	BLPop(timeout time.Duration, keys ...string) *redis.StringSliceCmd
	BRPop(timeout time.Duration, keys ...string) *redis.StringSliceCmd
	BRPopLPush(source, destination string, timeout time.Duration) *redis.StringCmd
}

type Client

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

Client a struct representing the redis client

func AutoConfigRedisClient

func AutoConfigRedisClient(rwType RWType) (*Client, error)

AutoConfigRedisClient merges configuration files and environment variables to create redisclient. parameter priority: environment variables > configuration file

func AutoConfigRedisClientFromEnv

func AutoConfigRedisClientFromEnv(rwType RWType) (*Client, error)

AutoConfigRedisClientFromEnv create redisclient using purely environment variables parameters

func AutoConfigRedisClientFromVolume

func AutoConfigRedisClientFromVolume(rwType RWType) (*Client, error)

AutoConfigRedisClientFromVolume create redisclient using parameters in the configuration file

func NewClient

func NewClient(opts Options) *Client

NewClient Initiates a new client

func (*Client) Append

func (r *Client) Append(key, value string) *redis.IntCmd

func (*Client) BLPop

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

func (*Client) BRPop

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

func (*Client) BRPopLPush

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

func (*Client) Decr

func (r *Client) Decr(key string) *redis.IntCmd

Decr decrements the key by 1

func (*Client) DecrBy

func (r *Client) DecrBy(key string, value int64) *redis.IntCmd

DecrBy decrements using a increment value

func (*Client) Del

func (r *Client) Del(keys ...string) *redis.IntCmd

func (*Client) Dump

func (r *Client) Dump(key string) *redis.StringCmd

Dump dump command

func (*Client) Exists

func (r *Client) Exists(key ...string) *redis.IntCmd

Exists exists command

func (*Client) Expire

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

Expire expire method

func (*Client) ExpireAt

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

ExpireAt expireat method

func (*Client) Get

func (r *Client) Get(key string) *redis.StringCmd

Get get key value

func (*Client) GetBit

func (r *Client) GetBit(key string, offset int64) *redis.IntCmd

GetBit getbit key value

func (*Client) GetClient

func (r *Client) GetClient() Commander

GetClient returns the client

func (*Client) GetRange

func (r *Client) GetRange(key string, start, end int64) *redis.StringCmd

GetRange GetRange key value

func (*Client) GetSet

func (r *Client) GetSet(key string, value interface{}) *redis.StringCmd

GetSet getset command

func (*Client) HDel

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

func (*Client) HExists

func (r *Client) HExists(key, field string) *redis.BoolCmd

func (*Client) HGet

func (r *Client) HGet(key, field string) *redis.StringCmd

func (*Client) HGetAll

func (r *Client) HGetAll(key string) *redis.StringStringMapCmd

func (*Client) HIncrBy

func (r *Client) HIncrBy(key, field string, incr int64) *redis.IntCmd

func (*Client) HIncrByFloat

func (r *Client) HIncrByFloat(key, field string, incr float64) *redis.FloatCmd

func (*Client) HKeys

func (r *Client) HKeys(key string) *redis.StringSliceCmd

func (*Client) HLen

func (r *Client) HLen(key string) *redis.IntCmd

func (*Client) HMGet

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

func (*Client) HMSet

func (r *Client) HMSet(key string, fields map[string]interface{}) *redis.StatusCmd

func (*Client) HScan

func (r *Client) HScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd

func (*Client) HSet

func (r *Client) HSet(key, field string, value interface{}) *redis.BoolCmd

func (*Client) HSetNX

func (r *Client) HSetNX(key, field string, value interface{}) *redis.BoolCmd

func (*Client) HVals

func (r *Client) HVals(key string) *redis.StringSliceCmd

func (*Client) Incr

func (r *Client) Incr(key string) *redis.IntCmd

Incr increments the key by 1

func (*Client) IncrBy

func (r *Client) IncrBy(key string, value int64) *redis.IntCmd

IncrBy increments using a increment value

func (*Client) IsCluster

func (r *Client) IsCluster() bool

IsCluster determine whether client is a cluster model

func (*Client) LIndex

func (r *Client) LIndex(key string, index int64) *redis.StringCmd

func (*Client) LInsert

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

func (*Client) LInsertAfter

func (r *Client) LInsertAfter(key string, pivot, value interface{}) *redis.IntCmd

func (*Client) LInsertBefore

func (r *Client) LInsertBefore(key string, pivot, value interface{}) *redis.IntCmd

func (*Client) LLen

func (r *Client) LLen(key string) *redis.IntCmd

func (*Client) LPop

func (r *Client) LPop(key string) *redis.StringCmd

func (*Client) LPush

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

func (*Client) LPushX

func (r *Client) LPushX(key string, value interface{}) *redis.IntCmd

func (*Client) LRange

func (r *Client) LRange(key string, start, stop int64) *redis.StringSliceCmd

func (*Client) LRem

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

func (*Client) LSet

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

func (*Client) LTrim

func (r *Client) LTrim(key string, start, stop int64) *redis.StatusCmd

func (*Client) MGet

func (r *Client) MGet(keys ...string) *redis.SliceCmd

MGet Multiple get command

func (*Client) MGetByPipeline

func (r *Client) MGetByPipeline(keys ...string) ([]string, error)

MGetByPipeline gets multiple values from keys,Pipeline is used when redis is a cluster,This means higher IO performance params: keys ...string return: []string, error

func (*Client) PExpire

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

PExpire redis command

func (*Client) PExpireAt

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

func (*Client) PTTL

func (r *Client) PTTL(key string) *redis.DurationCmd

func (*Client) Persist

func (r *Client) Persist(key string) *redis.BoolCmd

Persist persist command

func (*Client) Ping

func (r *Client) Ping() *redis.StatusCmd

Ping sends a Ping command

func (*Client) Pipeline

func (r *Client) Pipeline() redis.Pipeliner

Pipeline get Pipeliner of r.client

func (*Client) Prefix

func (r *Client) Prefix(key string) string

Prefix return prefix+key

func (*Client) Publish

func (r *Client) Publish(channel string, message interface{}) *redis.IntCmd

func (*Client) RPop

func (r *Client) RPop(key string) *redis.StringCmd

func (*Client) RPopLPush

func (r *Client) RPopLPush(source, destination string) *redis.StringCmd

func (*Client) RPush

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

func (*Client) RPushX

func (r *Client) RPushX(key string, value interface{}) *redis.IntCmd

func (*Client) SAdd

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

func (*Client) SCard

func (r *Client) SCard(key string) *redis.IntCmd

func (*Client) SDiff

func (r *Client) SDiff(keys ...string) *redis.StringSliceCmd

func (*Client) SDiffStore

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

func (*Client) SInter

func (r *Client) SInter(keys ...string) *redis.StringSliceCmd

func (*Client) SInterStore

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

func (*Client) SIsMember

func (r *Client) SIsMember(key string, member interface{}) *redis.BoolCmd

func (*Client) SMembers

func (r *Client) SMembers(key string) *redis.StringSliceCmd

func (*Client) SMove

func (r *Client) SMove(source, destination string, member interface{}) *redis.BoolCmd

func (*Client) SPop

func (r *Client) SPop(key string) *redis.StringCmd

func (*Client) SPopN

func (r *Client) SPopN(key string, count int64) *redis.StringSliceCmd

func (*Client) SRandMember

func (r *Client) SRandMember(key string) *redis.StringCmd

func (*Client) SRandMemberN

func (r *Client) SRandMemberN(key string, count int64) *redis.StringSliceCmd

func (*Client) SRem

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

func (*Client) SScan

func (r *Client) SScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd

func (*Client) SUnion

func (r *Client) SUnion(keys ...string) *redis.StringSliceCmd

func (*Client) SUnionStore

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

func (*Client) Scan

func (r *Client) Scan(cursor uint64, match string, count int64) *redis.ScanCmd

func (*Client) Set

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

Set function

func (*Client) Subscribe

func (r *Client) Subscribe(channels ...string) *redis.PubSub

func (*Client) TTL

func (r *Client) TTL(key string) *redis.DurationCmd

func (*Client) Type

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

func (*Client) ZAdd

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

func (*Client) ZAddCh

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

func (*Client) ZAddNX

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

func (*Client) ZAddNXCh

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

func (*Client) ZAddXX

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

func (*Client) ZAddXXCh

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

func (*Client) ZCard

func (r *Client) ZCard(key string) *redis.IntCmd

func (*Client) ZCount

func (r *Client) ZCount(key, min, max string) *redis.IntCmd

func (*Client) ZIncr

func (r *Client) ZIncr(key string, member redis.Z) *redis.FloatCmd

func (*Client) ZIncrBy

func (r *Client) ZIncrBy(key string, increment float64, member string) *redis.FloatCmd

func (*Client) ZIncrNX

func (r *Client) ZIncrNX(key string, member redis.Z) *redis.FloatCmd

func (*Client) ZIncrXX

func (r *Client) ZIncrXX(key string, member redis.Z) *redis.FloatCmd

func (*Client) ZInterStore

func (r *Client) ZInterStore(key string, store redis.ZStore, keys ...string) *redis.IntCmd

func (*Client) ZRange

func (r *Client) ZRange(key string, start, stop int64) *redis.StringSliceCmd

func (*Client) ZRangeByLex

func (r *Client) ZRangeByLex(key string, opt redis.ZRangeBy) *redis.StringSliceCmd

func (*Client) ZRangeByScore

func (r *Client) ZRangeByScore(key string, opt redis.ZRangeBy) *redis.StringSliceCmd

func (*Client) ZRangeByScoreWithScores

func (r *Client) ZRangeByScoreWithScores(key string, opt redis.ZRangeBy) *redis.ZSliceCmd

func (*Client) ZRangeWithScores

func (r *Client) ZRangeWithScores(key string, start, stop int64) *redis.ZSliceCmd

func (*Client) ZRank

func (r *Client) ZRank(key, member string) *redis.IntCmd

func (*Client) ZRem

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

func (*Client) ZRemRangeByLex

func (r *Client) ZRemRangeByLex(key, min, max string) *redis.IntCmd

func (*Client) ZRemRangeByRank

func (r *Client) ZRemRangeByRank(key string, start, stop int64) *redis.IntCmd

func (*Client) ZRemRangeByScore

func (r *Client) ZRemRangeByScore(key, min, max string) *redis.IntCmd

func (*Client) ZRevRange

func (r *Client) ZRevRange(key string, start, stop int64) *redis.StringSliceCmd

func (*Client) ZRevRangeByLex

func (r *Client) ZRevRangeByLex(key string, opt redis.ZRangeBy) *redis.StringSliceCmd

func (*Client) ZRevRangeByScore

func (r *Client) ZRevRangeByScore(key string, opt redis.ZRangeBy) *redis.StringSliceCmd

func (*Client) ZRevRangeByScoreWithScores

func (r *Client) ZRevRangeByScoreWithScores(key string, opt redis.ZRangeBy) *redis.ZSliceCmd

func (*Client) ZRevRangeWithScores

func (r *Client) ZRevRangeWithScores(key string, start, stop int64) *redis.ZSliceCmd

func (*Client) ZRevRank

func (r *Client) ZRevRank(key, member string) *redis.IntCmd

func (*Client) ZScan

func (r *Client) ZScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd

func (*Client) ZScore

func (r *Client) ZScore(key, member string) *redis.FloatCmd

func (*Client) ZUnionStore

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

type ClientType

type ClientType string

ClientType type to define a redis client connector

const (
	// ClientNormal for standard instance client
	ClientNormal ClientType = "normal"
	// ClientCluster for official redis cluster
	ClientCluster ClientType = "cluster"
)

type Commander

Commander an interface containing all methods

type Decremeter

type Decremeter interface {
	Decr(key string) *redis.IntCmd
	DecrBy(key string, value int64) *redis.IntCmd
}

Decremeter interface to decrement

type Expirer

type Expirer interface {
	Expire(key string, expiration time.Duration) *redis.BoolCmd
	ExpireAt(key string, tm time.Time) *redis.BoolCmd
	Persist(key string) *redis.BoolCmd

	PExpire(key string, expiration time.Duration) *redis.BoolCmd
	PExpireAt(key string, tm time.Time) *redis.BoolCmd
	PTTL(key string) *redis.DurationCmd
	TTL(key string) *redis.DurationCmd
}

Expirer interface for expire methods

type Getter

type Getter interface {
	Exists(keys ...string) *redis.IntCmd
	Get(key string) *redis.StringCmd
	GetBit(key string, offset int64) *redis.IntCmd
	GetRange(key string, start, end int64) *redis.StringCmd
	GetSet(key string, value interface{}) *redis.StringCmd
	MGet(keys ...string) *redis.SliceCmd
	Dump(key string) *redis.StringCmd
}

Getter interface for getting key commands

type Hasher

type Hasher interface {
	HExists(key, field string) *redis.BoolCmd
	HGet(key, field string) *redis.StringCmd
	HGetAll(key string) *redis.StringStringMapCmd
	HIncrBy(key, field string, incr int64) *redis.IntCmd
	HIncrByFloat(key, field string, incr float64) *redis.FloatCmd
	HKeys(key string) *redis.StringSliceCmd
	HLen(key string) *redis.IntCmd
	HMGet(key string, fields ...string) *redis.SliceCmd
	HMSet(key string, fields map[string]interface{}) *redis.StatusCmd
	HSet(key, field string, value interface{}) *redis.BoolCmd
	HSetNX(key, field string, value interface{}) *redis.BoolCmd
	HVals(key string) *redis.StringSliceCmd
	HDel(key string, fields ...string) *redis.IntCmd
}

Hasher interface for hashtable commands

type Incrementer

type Incrementer interface {
	Incr(key string) *redis.IntCmd
	IncrBy(key string, value int64) *redis.IntCmd
}

Incrementer interface to increment

type Lister

type Lister interface {
	LIndex(key string, index int64) *redis.StringCmd
	LInsert(key, op string, pivot, value interface{}) *redis.IntCmd
	LInsertAfter(key string, pivot, value interface{}) *redis.IntCmd
	LInsertBefore(key string, pivot, value interface{}) *redis.IntCmd
	LLen(key string) *redis.IntCmd
	LPop(key string) *redis.StringCmd
	LPush(key string, values ...interface{}) *redis.IntCmd
	LPushX(key string, value interface{}) *redis.IntCmd
	LRange(key string, start, stop int64) *redis.StringSliceCmd
	LRem(key string, count int64, value interface{}) *redis.IntCmd
	LSet(key string, index int64, value interface{}) *redis.StatusCmd
	LTrim(key string, start, stop int64) *redis.StatusCmd
	RPop(key string) *redis.StringCmd
	RPopLPush(source, destination string) *redis.StringCmd
	RPush(key string, values ...interface{}) *redis.IntCmd
	RPushX(key string, value interface{}) *redis.IntCmd
}

type Options

type Options struct {
	Type ClientType
	// Host address with port number
	// For normal client will only used the first value
	Hosts []string

	// The network type, either tcp or unix.
	// Default is tcp.
	// Only for normal client
	Network string

	// Database to be selected after connecting to the server.
	Database int
	// Automatically adds a prefix to all keys
	KeyPrefix string

	// The maximum number of retries before giving up. Command is retried
	// on network errors and MOVED/ASK redirects.
	// Default is 16.
	// In normal client this is the MaxRetries option
	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.
	// If set will change this client to read-only mode
	RouteByLatency bool

	// Following options are copied from Options struct.
	Password string

	// 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

	// PoolSize applies per cluster node and not for the whole cluster.
	// 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

	// TLS Config to use. When set TLS will be negotiated.
	// Only for normal client
	TLSConfig *tls.Config
}

Options options to initiate your client

func (Options) GetClusterConfig

func (o Options) GetClusterConfig() *redis.ClusterOptions

GetClusterConfig translates current configuration into a *redis.ClusterOptions

func (Options) GetNormalConfig

func (o Options) GetNormalConfig() *redis.Options

GetNormalConfig translates current configuration into a *redis.Options struct

type Pinger

type Pinger interface {
	Ping() *redis.StatusCmd
}

Pinger pinger interface for redis clients

type Pipeline

type Pipeline interface {
	Pipeline() redis.Pipeliner
}

type Publisher

type Publisher interface {
	Publish(channel string, message interface{}) *redis.IntCmd
}

type RWType

type RWType string

Client Reader and Writer

const (
	// OnlyRead serves as a search suffix for configuration parameters
	OnlyRead RWType = "READER"
	// OnlyWrite serves as a search suffix for configuration parameters
	OnlyWrite RWType = "WRITER"
	// ReadAndWrite serves as a search suffix for configuration parameters
	ReadAndWrite RWType = ""
)

func (*RWType) FmtSuffix

func (rw *RWType) FmtSuffix(key string) string

FmtSuffix get fmtstring of key+ "_" + suffix

func (*RWType) IsReadOnly

func (rw *RWType) IsReadOnly() bool

IsReadOnly will return Is it read-only

type Scanner

type Scanner interface {
	Type(key string) *redis.StatusCmd
	Scan(cursor uint64, match string, count int64) *redis.ScanCmd
	SScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd
	HScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd
	ZScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd
}

type Settable

type Settable interface {
	SAdd(key string, members ...interface{}) *redis.IntCmd
	SCard(key string) *redis.IntCmd
	SDiff(keys ...string) *redis.StringSliceCmd
	SDiffStore(destination string, keys ...string) *redis.IntCmd
	SInter(keys ...string) *redis.StringSliceCmd
	SInterStore(destination string, keys ...string) *redis.IntCmd
	SIsMember(key string, member interface{}) *redis.BoolCmd
	SMembers(key string) *redis.StringSliceCmd
	SMove(source, destination string, member interface{}) *redis.BoolCmd
	SPop(key string) *redis.StringCmd
	SPopN(key string, count int64) *redis.StringSliceCmd
	SRandMember(key string) *redis.StringCmd
	SRandMemberN(key string, count int64) *redis.StringSliceCmd
	SRem(key string, members ...interface{}) *redis.IntCmd
	SUnion(keys ...string) *redis.StringSliceCmd
	SUnionStore(destination string, keys ...string) *redis.IntCmd
}

type Setter

type Setter interface {
	Set(key string, value interface{}, expiration time.Duration) *redis.StatusCmd
	Append(key, value string) *redis.IntCmd
	Del(keys ...string) *redis.IntCmd
	Unlink(keys ...string) *redis.IntCmd
}

Setter interface for setting key commands

type SortedSettable

type SortedSettable interface {
	ZAdd(key string, members ...redis.Z) *redis.IntCmd
	ZAddNX(key string, members ...redis.Z) *redis.IntCmd
	ZAddXX(key string, members ...redis.Z) *redis.IntCmd
	ZAddCh(key string, members ...redis.Z) *redis.IntCmd
	ZAddNXCh(key string, members ...redis.Z) *redis.IntCmd
	ZAddXXCh(key string, members ...redis.Z) *redis.IntCmd
	ZIncr(key string, member redis.Z) *redis.FloatCmd
	ZIncrNX(key string, member redis.Z) *redis.FloatCmd
	ZIncrXX(key string, member redis.Z) *redis.FloatCmd
	ZCard(key string) *redis.IntCmd
	ZCount(key, min, max string) *redis.IntCmd
	ZIncrBy(key string, increment float64, member string) *redis.FloatCmd
	ZInterStore(destination string, store redis.ZStore, keys ...string) *redis.IntCmd
	ZRange(key string, start, stop int64) *redis.StringSliceCmd
	ZRangeWithScores(key string, start, stop int64) *redis.ZSliceCmd
	ZRangeByScore(key string, opt redis.ZRangeBy) *redis.StringSliceCmd
	ZRangeByLex(key string, opt redis.ZRangeBy) *redis.StringSliceCmd
	ZRangeByScoreWithScores(key string, opt redis.ZRangeBy) *redis.ZSliceCmd
	ZRank(key, member string) *redis.IntCmd
	ZRem(key string, members ...interface{}) *redis.IntCmd
	ZRemRangeByRank(key string, start, stop int64) *redis.IntCmd
	ZRemRangeByScore(key, min, max string) *redis.IntCmd
	ZRemRangeByLex(key, min, max string) *redis.IntCmd
	ZRevRange(key string, start, stop int64) *redis.StringSliceCmd
	ZRevRangeWithScores(key string, start, stop int64) *redis.ZSliceCmd
	ZRevRangeByScore(key string, opt redis.ZRangeBy) *redis.StringSliceCmd
	ZRevRangeByLex(key string, opt redis.ZRangeBy) *redis.StringSliceCmd
	ZRevRangeByScoreWithScores(key string, opt redis.ZRangeBy) *redis.ZSliceCmd
	ZRevRank(key, member string) *redis.IntCmd
	ZScore(key, member string) *redis.FloatCmd
	ZUnionStore(dest string, store redis.ZStore, keys ...string) *redis.IntCmd
}

type Subscriber

type Subscriber interface {
	Subscribe(channels ...string) *redis.PubSub
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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