mirror of
https://github.com/mailgun/groupcache.git
synced 2024-10-01 20:32:05 +00:00
feat(add DeregisterGroup method): DeregisterGroup removes group from group pool
This commit is contained in:
parent
ba255c644a
commit
f06dad867e
@ -85,6 +85,13 @@ func NewGroup(name string, cacheBytes int64, getter Getter) *Group {
|
|||||||
return newGroup(name, cacheBytes, getter, nil)
|
return newGroup(name, cacheBytes, getter, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeregisterGroup removes group from group pool
|
||||||
|
func DeregisterGroup(name string) {
|
||||||
|
mu.Lock()
|
||||||
|
delete(groups, name)
|
||||||
|
mu.Unlock()
|
||||||
|
}
|
||||||
|
|
||||||
// If peers is nil, the peerPicker is called via a sync.Once to initialize it.
|
// If peers is nil, the peerPicker is called via a sync.Once to initialize it.
|
||||||
func newGroup(name string, cacheBytes int64, getter Getter, peers PeerPicker) *Group {
|
func newGroup(name string, cacheBytes int64, getter Getter, peers PeerPicker) *Group {
|
||||||
if getter == nil {
|
if getter == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user