aboutsummaryrefslogtreecommitdiff
path: root/cache.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-25 02:24:52 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-25 02:24:52 +0800
commit958d64cc922b2688c910e339748fa28a0ff540b7 (patch)
tree7e0ebe68ce9bf31b051514682e95ee88c0dbfbec /cache.go
parentRevert "Add prometheus" (diff)
downloadforge-958d64cc922b2688c910e339748fa28a0ff540b7.tar.gz
forge-958d64cc922b2688c910e339748fa28a0ff540b7.tar.zst
forge-958d64cc922b2688c910e339748fa28a0ff540b7.zip
Cache commit logs on the repo index page
Diffstat (limited to 'cache.go')
-rw-r--r--cache.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/cache.go b/cache.go
index e745884..72c6458 100644
--- a/cache.go
+++ b/cache.go
@@ -29,3 +29,17 @@ func init() {
clog.Fatal(1, "Error initializing indexPageCache: "+err.Error())
}
}
+
+var indexCommitsDisplayCache *ristretto.Cache[[]byte, []commitDisplay]
+
+func init() {
+ var err error
+ indexCommitsDisplayCache, err = ristretto.NewCache(&ristretto.Config[[]byte, []commitDisplay]{
+ NumCounters: 1e4,
+ MaxCost: 1 << 30,
+ BufferItems: 64,
+ })
+ if err != nil {
+ clog.Fatal(1, "Error initializing indexCommitsCache: "+err.Error())
+ }
+}