aboutsummaryrefslogtreecommitdiff
path: root/cache_index_commits_display.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-25 03:08:10 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-25 03:08:10 +0800
commit18156b8847eea535899247a573c1c4311ba9ae0a (patch)
tree24e81c508524056ab276f0defbec5dba0e68c59d /cache_index_commits_display.go
parentFix group path trailing slash (diff)
downloadforge-18156b8847eea535899247a573c1c4311ba9ae0a.tar.gz
forge-18156b8847eea535899247a573c1c4311ba9ae0a.tar.zst
forge-18156b8847eea535899247a573c1c4311ba9ae0a.zip
Separate cache into separate files
Diffstat (limited to 'cache_index_commits_display.go')
-rw-r--r--cache_index_commits_display.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/cache_index_commits_display.go b/cache_index_commits_display.go
new file mode 100644
index 0000000..5d80943
--- /dev/null
+++ b/cache_index_commits_display.go
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// SPDX-FileContributor: Runxi Yu <https://runxiyu.org>
+
+package main
+
+import (
+ "github.com/dgraph-io/ristretto/v2"
+ "go.lindenii.runxiyu.org/lindenii-common/clog"
+)
+
+var indexCommitsDisplayCache *ristretto.Cache[[]byte, []commitDisplay]
+
+func init() {
+ var err error
+ indexCommitsDisplayCache, err = ristretto.NewCache(&ristretto.Config[[]byte, []commitDisplay]{
+ NumCounters: 1e4,
+ MaxCost: 1 << 60,
+ BufferItems: 8192,
+ })
+ if err != nil {
+ clog.Fatal(1, "Error initializing indexCommitsCache: "+err.Error())
+ }
+}