Documentation ¶
Index ¶
- type Getter
- type GetterFunc
- type Group
- func (g *Group) Get(key string) (*core.ByteView, error)
- func (g *Group) GetLocally(key string) (*core.ByteView, error)
- func (g *Group) Load(key string) (value *core.ByteView, err error)
- func (g *Group) PopulateCache(key string, value core.ByteView)
- func (g *Group) RegisterPeers(peers communication.PeerPicker)
- type HTTPGetter
- type HTTPPool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Getter ¶
Getter is a interface used to get data from different datasource eg: mysql, redis, pgsql
type GetterFunc ¶
A GetterFunc implements Getter with a function
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
A Group means a cache namespace,every group own a unique name eg: StudentGroup,InfoGroup, ....
func (*Group) GetLocally ¶
GetLocally Get data from user define data source and set data into mainCache(by populateCache method)
func (*Group) RegisterPeers ¶
func (g *Group) RegisterPeers(peers communication.PeerPicker)
Register HTTPPool into Group which is peers(peer picker)
type HTTPGetter ¶
type HTTPGetter struct {
// contains filtered or unexported fields
}
type HTTPPool ¶
type HTTPPool struct {
// contains filtered or unexported fields
}
func NewHTTPPool ¶
NewHTTPPool initializes an HTTP pool of peers.
func (*HTTPPool) PickPeer ¶
func (p *HTTPPool) PickPeer(key string) (communication.PeerGetter, bool)
包装了一致性哈希算法的 Get() 方法,根据具体的 key,选择节点, 返回节点对应的 HTTP 客户端。
Click to show internal directories.
Click to hide internal directories.