From 18156b8847eea535899247a573c1c4311ba9ae0a Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Tue, 25 Mar 2025 03:08:10 +0800 Subject: Separate cache into separate files --- cache_index_commits_display.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 cache_index_commits_display.go (limited to 'cache_index_commits_display.go') 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 + +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()) + } +} -- cgit v1.2.3