ResetCache removes all node from the hash cache.
()
| 220 | |
| 221 | // ResetCache removes all node from the hash cache. |
| 222 | func (c *Consistent) ResetCache() { |
| 223 | c.cacheLock.Lock() |
| 224 | defer c.cacheLock.Unlock() |
| 225 | |
| 226 | c.circle = make(map[proto.NodeKey]*proto.Node) |
| 227 | c.sortedHashes = NodeKeys{} |
| 228 | } |
| 229 | |
| 230 | // GetNeighbor returns an node close to where name hashes to in the circle. |
| 231 | func (c *Consistent) GetNeighbor(name string) (proto.Node, error) { |