This reverts commit 0361e8b97e.
The new cache ultimately did not give much benefit because the hit rate
was pretty low and it did not lead to any reduction in store timings.
So the increase in cluster messages was not worth it.
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a986aeb401
Коммит
bfaf4fa5dc
3
services/cache/cache.go
поставляемый
3
services/cache/cache.go
поставляемый
@@ -31,9 +31,6 @@ type Cache interface {
|
||||
// Remove deletes the value for a key.
|
||||
Remove(key string)
|
||||
|
||||
// RemoveByPrefix deletes all keys containing the given prefix string.
|
||||
RemoveByPrefix(prefix string)
|
||||
|
||||
// Keys returns a slice of the keys in the cache.
|
||||
Keys() []string
|
||||
|
||||
|
||||
18
services/cache/lru/lru.go
поставляемый
18
services/cache/lru/lru.go
поставляемый
@@ -12,7 +12,6 @@ package lru
|
||||
|
||||
import (
|
||||
"container/list"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -188,23 +187,6 @@ func (c *Cache) Remove(key string) {
|
||||
}
|
||||
}
|
||||
|
||||
// RemoveByPrefix deletes all keys containing the given prefix string.
|
||||
func (c *Cache) RemoveByPrefix(prefix string) {
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
|
||||
for ent := c.evictList.Back(); ent != nil; ent = ent.Prev() {
|
||||
e := ent.Value.(*entry)
|
||||
if e.generation == c.currentGeneration {
|
||||
if strings.HasPrefix(e.key, prefix) {
|
||||
if ent, ok := c.items[e.key]; ok {
|
||||
c.removeElement(ent)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Keys returns a slice of the keys in the cache, from oldest to newest.
|
||||
func (c *Cache) Keys() []string {
|
||||
c.lock.RLock()
|
||||
|
||||
Ссылка в новой задаче
Block a user