Less aggressive chunk cache invalidation for --tail

This commit is contained in:
Junegunn Choi
2024-06-10 20:30:19 +09:00
parent dfee7af57b
commit 7fc13c5cfd
7 changed files with 32 additions and 17 deletions

View File

@@ -22,6 +22,14 @@ func (cc *ChunkCache) Clear() {
cc.mutex.Unlock()
}
func (cc *ChunkCache) retire(chunk ...*Chunk) {
cc.mutex.Lock()
for _, c := range chunk {
delete(cc.cache, c)
}
cc.mutex.Unlock()
}
// Add adds the list to the cache
func (cc *ChunkCache) Add(chunk *Chunk, key string, list []Result) {
if len(key) == 0 || !chunk.IsFull() || len(list) > queryCacheMax {