Documentation ¶
Index ¶
- func DelNode(old map[string][]string, nodeName string) error
- func DelTopic(topic string) error
- func SubShare(topic, shareName, nodeName string) bool
- func UnSubShare(topic, shareName, nodeName string) bool
- type Group
- type Redis
- func (r *Redis) CloseCon() bool
- func (r *Redis) CreatCon(network, add, password string, db int) error
- func (r *Redis) DeleteV(key string) bool
- func (r *Redis) ExitsV(key string) bool
- func (r *Redis) GetV(key string) ([]byte, error)
- func (r *Redis) SetEXP(key string, time int64) (bool, error)
- func (r *Redis) SetNX(key string, value interface{}) bool
- func (r *Redis) SetNXHasTime(key string, value interface{}, time int64) bool
- func (r *Redis) SetV(key string, value interface{}) error
- func (r *Redis) SetVHasTime(key string, value interface{}, time int64) error
- type Result
- type ShareNameInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Group ¶
func (*Group) Do ¶
func (g *Group) Do(key string, fn func() (interface{}, error)) (v interface{}, err error, shared bool)
同步阻塞,容易因为fn中的阻塞,hang住了整个请求,导致全部都阻塞在这 最好使用DoChan,并对返回的chan做超时控制,防止因为单飞的那个请求一直阻塞,导致的全部阻塞
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
* * 自己想要其它的方法 , 可以通过 redis.Do( (1), ...) * (1): redis的执行命令第一个参数如 : set , lrang , delete * 后面的... 是接在后面的参数,比如set的key , value :set ,"key" , "value" * 参照 https://blog.csdn.net/wangshubo1989/article/details/75050024 *
func (*Redis) SetNXHasTime ¶
可以充当分布式锁,但是不会是死锁,到时间自动删除,只有不存在才会执行成功
type ShareNameInfo ¶
type ShareNameInfo struct { // contains filtered or unexported fields }
func NewShareNameInfo ¶
func NewShareNameInfo() *ShareNameInfo
func (*ShareNameInfo) RandShare ¶
func (s *ShareNameInfo) RandShare() map[string][]string
返回不同共享名称组应该发送给哪个节点的数据 返回节点名称:节点需要发送的共享组名称
Click to show internal directories.
Click to hide internal directories.