summaryrefslogtreecommitdiffstatshomepage
path: root/cache/subcache.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2022-12-22 00:48:00 +0100
committerMichael Muré <batolettre@gmail.com>2022-12-22 00:48:00 +0100
commitd65e8837aa7bb1a6abb6892b9f2664e1b7edb02e (patch)
tree331b05b689182b4d2bf43fd7cf92ca03b055bff0 /cache/subcache.go
parent9b98fc06489353053564b431ac0c0d73a5c55a56 (diff)
downloadgit-bug-d65e8837aa7bb1a6abb6892b9f2664e1b7edb02e.tar.gz
git-bug-d65e8837aa7bb1a6abb6892b9f2664e1b7edb02e.zip
cache: generic withSnapshot, some cleanup
Diffstat (limited to 'cache/subcache.go')
-rw-r--r--cache/subcache.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/cache/subcache.go b/cache/subcache.go
index 0678988a..af75938a 100644
--- a/cache/subcache.go
+++ b/cache/subcache.go
@@ -198,9 +198,10 @@ func (sc *SubCache[EntityT, ExcerptT, CacheT]) Build() error {
return e.Err
}
- // TODO: doesn't actually record in cache, should we?
cached := sc.makeCached(e.Entity, sc.entityUpdated)
sc.excerpts[e.Entity.Id()] = sc.makeExcerpt(cached)
+ // might as well keep them in memory
+ sc.cached[e.Entity.Id()] = cached
indexData := sc.makeIndexData(cached)
if err := indexer(e.Entity.Id().String(), indexData); err != nil {
@@ -417,12 +418,12 @@ func (sc *SubCache[EntityT, ExcerptT, CacheT]) MergeAll(remote string) <-chan en
switch result.Status {
case entity.MergeStatusNew, entity.MergeStatusUpdated:
e := result.Entity.(EntityT)
-
- // TODO: doesn't actually record in cache, should we?
cached := sc.makeCached(e, sc.entityUpdated)
sc.mu.Lock()
sc.excerpts[result.Id] = sc.makeExcerpt(cached)
+ // might as well keep them in memory
+ sc.cached[result.Id] = cached
sc.mu.Unlock()
}
}