From 958d64cc922b2688c910e339748fa28a0ff540b7 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Tue, 25 Mar 2025 02:24:52 +0800 Subject: Cache commit logs on the repo index page --- cache.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'cache.go') 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()) + } +} -- cgit v1.2.3