diff options
author | Runxi Yu <me@runxiyu.org> | 2025-03-25 02:24:52 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-03-25 02:24:52 +0800 |
commit | 958d64cc922b2688c910e339748fa28a0ff540b7 (patch) | |
tree | 7e0ebe68ce9bf31b051514682e95ee88c0dbfbec /cache.go | |
parent | Revert "Add prometheus" (diff) | |
download | forge-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.go | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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()) + } +} |