Refactor the code so that fzf can be used as a library (#3769)

This commit is contained in:
Junegunn Choi
2024-05-07 01:06:42 +09:00
committed by GitHub
parent 065b9e6fb2
commit e8405f40fe
32 changed files with 1152 additions and 893 deletions

View File

@@ -12,8 +12,14 @@ type ChunkCache struct {
}
// NewChunkCache returns a new ChunkCache
func NewChunkCache() ChunkCache {
return ChunkCache{sync.Mutex{}, make(map[*Chunk]*queryCache)}
func NewChunkCache() *ChunkCache {
return &ChunkCache{sync.Mutex{}, make(map[*Chunk]*queryCache)}
}
func (cc *ChunkCache) Clear() {
cc.mutex.Lock()
cc.cache = make(map[*Chunk]*queryCache)
cc.mutex.Unlock()
}
// Add adds the list to the cache