Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterNewGroupHook ¶
func RegisterNewGroupHook(fn func(*Group))
RegisterNewGroupHook registers a hook that is run each time a group is created.
Types ¶
type CacheStats ¶
CacheStats are returned by stats accessors on Group.
type GetterFunc ¶
A GetterFunc implements Getter with a function.
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
A Group is a cache namespace and associated data loaded spread over a group of 1 or more machines.
func GetGroup ¶
GetGroup returns the named group previously created with NewGroup, or nil if there's no such group.
func NewGroup ¶
func NewGroup(name string, cacheNum int, getter GetterFunc, onEvicted ...OnEvictedFunc) *Group
NewGroup creates a coordinated group-aware Getter from a Getter.
The returned Getter tries (but does not guarantee) to run only one Get call at once for a given key across an entire set of peer processes. Concurrent callers both in the local process and in other processes receive copies of the answer once the original Get completes.
The group name must be unique for each getter.
func (*Group) CacheStats ¶
func (g *Group) CacheStats() CacheStats
CacheStats returns stats about the provided cache within the group.