From 5509e0d1a4821acb1caaa2689965c18df17659fd Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Tue, 25 Mar 2025 02:58:46 +0800 Subject: Use cache for raw files too --- cache.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'cache.go') diff --git a/cache.go b/cache.go index 7259e38..59c4004 100644 --- a/cache.go +++ b/cache.go @@ -58,3 +58,17 @@ func init() { clog.Fatal(1, "Error initializing commitPathFileHTMLCache: "+err.Error()) } } + +var commitPathFileRawCache *ristretto.Cache[[]byte, string] + +func init() { + var err error + commitPathFileRawCache, err = ristretto.NewCache(&ristretto.Config[[]byte, string]{ + NumCounters: 1e4, + MaxCost: 1 << 60, + BufferItems: 8192, + }) + if err != nil { + clog.Fatal(1, "Error initializing commitPathFileRawCache: "+err.Error()) + } +} -- cgit v1.2.3