From 7a2bc2cada971c7a390d09b0afda34780ff56fb6 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 12 Jan 2015 03:01:24 +0900 Subject: Lint --- src/cache.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/cache.go') diff --git a/src/cache.go b/src/cache.go index 340f3258..f2f84a0a 100644 --- a/src/cache.go +++ b/src/cache.go @@ -2,16 +2,21 @@ package fzf import "sync" +// QueryCache associates strings to lists of items type QueryCache map[string][]*Item + +// ChunkCache associates Chunk and query string to lists of items type ChunkCache struct { mutex sync.Mutex cache map[*Chunk]*QueryCache } +// NewChunkCache returns a new ChunkCache func NewChunkCache() ChunkCache { return ChunkCache{sync.Mutex{}, make(map[*Chunk]*QueryCache)} } +// Add adds the list to the cache func (cc *ChunkCache) Add(chunk *Chunk, key string, list []*Item) { if len(key) == 0 || !chunk.IsFull() { return @@ -28,6 +33,7 @@ func (cc *ChunkCache) Add(chunk *Chunk, key string, list []*Item) { (*qc)[key] = list } +// Find is called to lookup ChunkCache func (cc *ChunkCache) Find(chunk *Chunk, key string) ([]*Item, bool) { if len(key) == 0 || !chunk.IsFull() { return nil, false -- cgit v1.2.3