aboutsummaryrefslogtreecommitdiff
path: root/cache.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-25 02:58:46 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-25 02:58:46 +0800
commit5509e0d1a4821acb1caaa2689965c18df17659fd (patch)
treec8e2c7026d8409f59d43359eb76486d13c59d947 /cache.go
parentCache file view (diff)
downloadforge-5509e0d1a4821acb1caaa2689965c18df17659fd.tar.gz
forge-5509e0d1a4821acb1caaa2689965c18df17659fd.tar.zst
forge-5509e0d1a4821acb1caaa2689965c18df17659fd.zip
Use cache for raw files too
Diffstat (limited to '')
-rw-r--r--cache.go14
1 files changed, 14 insertions, 0 deletions
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())
+ }
+}