Documentation ¶
Index ¶
- Constants
- Variables
- func ChecksumCRC16(data []byte) uint16
- func Do(commandName string, args ...interface{}) (reply interface{}, err error)
- func SetRefreshNeeded()
- type Command
- type Commands
- type Pool
- func (this *Pool) Close()
- func (this *Pool) Do(commandName string, args ...interface{}) (reply interface{}, err error)
- func (this *Pool) Get() (*RedisConn, error)
- func (this *Pool) Put(elem *RedisConn)
- func (this *Pool) SetLifeTime(d int)
- func (this *Pool) SetWaitTime(d int)
- func (this *Pool) Update(maxIdle, maxActive int32)
- type RedisCluster
- func (self *RedisCluster) Do(cmd string, args ...interface{}) (reply interface{}, err error)
- func (self *RedisCluster) GetHandle(key string) *RedisHandle
- func (self *RedisCluster) HandleForKey(key string) *RedisHandle
- func (self *RedisCluster) KeyForRequest(cmd string, args ...interface{}) string
- func (self *RedisCluster) RandomRedisHandle() *RedisHandle
- func (self *RedisCluster) RedisHandleForSlot(slot uint16) *RedisHandle
- func (self *RedisCluster) SendClusterCommand(cmd string, args ...interface{}) (reply interface{}, err error)
- func (self *RedisCluster) SetLifeTime(t int)
- func (self *RedisCluster) SetRefreshNeeded()
- func (self *RedisCluster) SetWaitTime(t int)
- func (self *RedisCluster) SlotForKey(key string) uint16
- func (self *RedisCluster) TestCluster() error
- func (self *RedisCluster) Update(max_idle, max_active int32)
- type RedisClusterAccess
- type RedisConn
- type RedisHandle
- type RedisReply
- type Table
Constants ¶
View Source
const ( REDIS_REPLY_STRING = 1 REDIS_REPLY_ARRAY = 2 REDIS_REPLY_INTEGER = 3 REDIS_REPLY_NIL = 4 REDIS_REPLY_STATUS = 5 REDIS_REPLY_ERROR = 6 )
View Source
const RedisClusterDefaultTimeout = 1
View Source
const RedisClusterHashSlots = 16384
View Source
const RedisClusterRequestTTL = 16
Variables ¶
View Source
var RedisTable = Table{}/* 256 elements not displayed */
Functions ¶
func ChecksumCRC16 ¶
func SetRefreshNeeded ¶
func SetRefreshNeeded()
Types ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func (*Pool) SetLifeTime ¶
func (*Pool) SetWaitTime ¶
type RedisCluster ¶
type RedisCluster struct { SeedHosts map[string]bool Handles map[string]*RedisHandle Slots map[uint16]string RefreshTableASAP bool SingleRedisMode bool MaxIdle int MaxActive int Debug bool }
var Instance RedisCluster
func NewRedisCluster ¶
func NewRedisCluster(addrs []string, max_idle, max_active int, debug bool) RedisCluster
func (*RedisCluster) Do ¶
func (self *RedisCluster) Do(cmd string, args ...interface{}) (reply interface{}, err error)
func (*RedisCluster) GetHandle ¶
func (self *RedisCluster) GetHandle(key string) *RedisHandle
func (*RedisCluster) HandleForKey ¶
func (self *RedisCluster) HandleForKey(key string) *RedisHandle
func (*RedisCluster) KeyForRequest ¶
func (self *RedisCluster) KeyForRequest(cmd string, args ...interface{}) string
func (*RedisCluster) RandomRedisHandle ¶
func (self *RedisCluster) RandomRedisHandle() *RedisHandle
func (*RedisCluster) RedisHandleForSlot ¶
func (self *RedisCluster) RedisHandleForSlot(slot uint16) *RedisHandle
Given a slot return the link (Redis instance) to the mapped node. Make sure to create a connection with the node if we don't have one.
func (*RedisCluster) SendClusterCommand ¶
func (self *RedisCluster) SendClusterCommand(cmd string, args ...interface{}) (reply interface{}, err error)
func (*RedisCluster) SetLifeTime ¶
func (self *RedisCluster) SetLifeTime(t int)
func (*RedisCluster) SetRefreshNeeded ¶
func (self *RedisCluster) SetRefreshNeeded()
func (*RedisCluster) SetWaitTime ¶
func (self *RedisCluster) SetWaitTime(t int)
func (*RedisCluster) SlotForKey ¶
func (self *RedisCluster) SlotForKey(key string) uint16
Return the hash slot from the key.
func (*RedisCluster) TestCluster ¶
func (self *RedisCluster) TestCluster() error
func (*RedisCluster) Update ¶
func (self *RedisCluster) Update(max_idle, max_active int32)
type RedisClusterAccess ¶
type RedisClusterAccess interface { Do(commandName string, args ...interface{}) (reply interface{}, err error) // Send(cmd string, args ...interface{}) (err error) SetRefreshNeeded() HandleForKey(key string) *RedisHandle }
type RedisConn ¶
func (RedisConn) Command ¶
func (this RedisConn) Command(commandName string, args ...interface{}) *RedisReply
type RedisHandle ¶
func HandleForKey ¶
func HandleForKey(key string) *RedisHandle
func NewRedisHandle ¶
func NewRedisHandle(addr string, max_idle, max_active int, debug bool) *RedisHandle
XXX: add some password protection
func (*RedisHandle) Do ¶
func (self *RedisHandle) Do(commandName string, args ...interface{}) (reply interface{}, err error)
func (*RedisHandle) GetRedisConn ¶
func (self *RedisHandle) GetRedisConn() (*RedisConn, error)
func (*RedisHandle) Send ¶
func (self *RedisHandle) Send(cmd string, args ...interface{}) (err error)
XXX: is _not_ calling defer rc.Close()
so do it yourself later
type RedisReply ¶
type RedisReply struct { Type int /* REDIS_REPLY_* */ Integer int64 /* The integer when type is REDIS_REPLY_INTEGER */ Len int /* Length of string */ Str string /* Used for both REDIS_REPLY_ERROR and REDIS_REPLY_STRING */ Elements int /* number of elements, for REDIS_REPLY_ARRAY */ Element []*RedisReply /* elements vector for REDIS_REPLY_ARRAY */ }
func NewRedisReply ¶
func NewRedisReply(re interface{}, err error) *RedisReply
Source Files ¶
Click to show internal directories.
Click to hide internal directories.