Documentation
¶
Overview ¶
Package cluster provides a server side cluster which is transparent to client. You can connect to any node in the cluster to access all data in the cluster
Index ¶
- func Copy(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func Del(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func FlushAll(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func FlushDB(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func MGet(cluster *Cluster, c redis.Connection, cmdLine CmdLine) redis.Reply
- func MSet(cluster *Cluster, c redis.Connection, cmdLine CmdLine) redis.Reply
- func MSetNX(cluster *Cluster, c redis.Connection, cmdLine CmdLine) redis.Reply
- func Publish(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func Rename(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func RenameNx(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func Subscribe(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- func UnSubscribe(cluster *Cluster, c redis.Connection, args [][]byte) redis.Reply
- type Cluster
- type CmdFunc
- type CmdLine
- type PeerPicker
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Copy ¶ added in v1.2.9
Copy copies the value stored at the source key to the destination key. the origin and the destination must within the same node.
func Del ¶
Del atomically removes given writeKeys from cluster, writeKeys can be distributed on any node if the given writeKeys are distributed on different node, Del will use try-commit-catch to remove them
func MGet ¶
MGet atomically get multi key-value from cluster, writeKeys can be distributed on any node
func MSet ¶
MSet atomically sets multi key-value in cluster, writeKeys can be distributed on any node
func MSetNX ¶
MSetNX sets multi key-value in database, only if none of the given writeKeys exist and all given writeKeys are on the same node
func Publish ¶
Publish broadcasts msg to all peers in cluster when receive publish command from client
func RenameNx ¶
RenameNx renames a key, only if the new key does not exist. The origin and the destination must within the same node
func UnSubscribe ¶
UnSubscribe removes the given connection from the given channel
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Cluster represents a node of godis cluster it holds part of data and coordinates other nodes to finish transactions
func (*Cluster) AfterClientClose ¶
func (cluster *Cluster) AfterClientClose(c redis.Connection)
AfterClientClose does some clean after client close connection
type CmdLine ¶ added in v1.2.7
type CmdLine = [][]byte
CmdLine is alias for [][]byte, represents a command line
type PeerPicker ¶ added in v1.2.8
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction stores state and data for a try-commit-catch distributed transaction
func NewTransaction ¶
func NewTransaction(cluster *Cluster, c redis.Connection, id string, cmdLine [][]byte) *Transaction
NewTransaction creates a try-commit-catch distributed transaction