diff options
author | Michael Muré <batolettre@gmail.com> | 2022-11-19 11:33:12 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2022-11-28 17:20:25 +0100 |
commit | 0ac39a7ab5db077fcf0df827e32bf6e625e980da (patch) | |
tree | e453d6fd244cb322bdc6305c0088aa3c0331b075 /cache/repo_cache.go | |
parent | c6bb6b9c7ecddb679966b1561e2e909a9ee5e8cd (diff) | |
download | git-bug-0ac39a7ab5db077fcf0df827e32bf6e625e980da.tar.gz |
WIP
Diffstat (limited to 'cache/repo_cache.go')
-rw-r--r-- | cache/repo_cache.go | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/cache/repo_cache.go b/cache/repo_cache.go index 71abf968..c1646d3b 100644 --- a/cache/repo_cache.go +++ b/cache/repo_cache.go @@ -52,16 +52,7 @@ type RepoCache struct { // resolvers for all known entities resolvers entity.Resolvers - // maximum number of loaded bugs - maxLoadedBugs int - - muBug sync.RWMutex - // excerpt of bugs data for all bugs - bugExcerpts map[entity.Id]*BugExcerpt - // bug loaded in memory - bugs map[entity.Id]*BugCache - // loadedBugs is an LRU cache that records which bugs the cache has loaded in - loadedBugs *LRUIdCache + bugs *RepoCacheBug muIdentity sync.RWMutex // excerpt of identities data for all identities @@ -79,12 +70,13 @@ func NewRepoCache(r repository.ClockedRepo) (*RepoCache, error) { func NewNamedRepoCache(r repository.ClockedRepo, name string) (*RepoCache, error) { c := &RepoCache{ - repo: r, - name: name, - maxLoadedBugs: defaultMaxLoadedBugs, - bugs: make(map[entity.Id]*BugCache), - loadedBugs: NewLRUIdCache(), - identities: make(map[entity.Id]*IdentityCache), + repo: r, + name: name, + bugs: NewCache(r), + // maxLoadedBugs: defaultMaxLoadedBugs, + // bugs: make(map[entity.Id]*BugCache), + // loadedBugs: newLRUIdCache(), + // identities: make(map[entity.Id]*IdentityCache), } c.resolvers = makeResolvers(c) @@ -108,6 +100,11 @@ func NewNamedRepoCache(r repository.ClockedRepo, name string) (*RepoCache, error return c, c.write() } +// Bugs gives access to the Bug entities +func (c *RepoCache) Bugs() *RepoCacheBug { + return c.bugs +} + // setCacheSize change the maximum number of loaded bugs func (c *RepoCache) setCacheSize(size int) { c.maxLoadedBugs = size |