From 04d9de0fae664502ea7d8b75be0d66e8ba9d2784 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sat, 05 Apr 2025 17:38:34 +0800 Subject: [PATCH] Remove current caching mechanisms --- cache_commit_path_file_html.go | 26 -------------------------- cache_commit_path_file_raw.go | 24 ------------------------ cache_commit_tree_readme.go | 32 -------------------------------- cache_index_commits_display.go | 24 ------------------------ diff --git a/cache_commit_path_file_html.go b/cache_commit_path_file_html.go deleted file mode 100644 index 9254d6b8ba85c26331ca9e4147f524b66029dafd..0000000000000000000000000000000000000000 --- a/cache_commit_path_file_html.go +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-License-Identifier: AGPL-3.0-only -// SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu - -package main - -import ( - "html/template" - - "github.com/dgraph-io/ristretto/v2" - "go.lindenii.runxiyu.org/lindenii-common/clog" -) - -// The key is the commit ID raw hash, followed by the file path. -var commitPathFileHTMLCache *ristretto.Cache[[]byte, template.HTML] - -func init() { - var err error - commitPathFileHTMLCache, err = ristretto.NewCache(&ristretto.Config[[]byte, template.HTML]{ - NumCounters: 1e4, - MaxCost: 1 << 60, - BufferItems: 8192, - }) - if err != nil { - clog.Fatal(1, "Error initializing commitPathFileHTMLCache: "+err.Error()) - } -} diff --git a/cache_commit_path_file_raw.go b/cache_commit_path_file_raw.go deleted file mode 100644 index 89b817b6fee67f0291d33e131a214a9c80b46edc..0000000000000000000000000000000000000000 --- a/cache_commit_path_file_raw.go +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: AGPL-3.0-only -// SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu - -package main - -import ( - "github.com/dgraph-io/ristretto/v2" - "go.lindenii.runxiyu.org/lindenii-common/clog" -) - -// The key is the commit ID raw hash, followed by the file path. -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()) - } -} diff --git a/cache_commit_tree_readme.go b/cache_commit_tree_readme.go deleted file mode 100644 index afd7f3e39c6d27bff64e4bf4d64ae0de5a8ddf47..0000000000000000000000000000000000000000 --- a/cache_commit_tree_readme.go +++ /dev/null @@ -1,32 +0,0 @@ -// SPDX-License-Identifier: AGPL-3.0-only -// SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu - -package main - -import ( - "html/template" - - "github.com/dgraph-io/ristretto/v2" - "go.lindenii.runxiyu.org/lindenii-common/clog" -) - -type treeReadmeCacheEntry struct { - DisplayTree []displayTreeEntry - ReadmeFilename string - ReadmeRendered template.HTML -} - -// The key is the commit ID raw hash, optionally followed by a path. -var treeReadmeCache *ristretto.Cache[[]byte, treeReadmeCacheEntry] - -func init() { - var err error - treeReadmeCache, err = ristretto.NewCache(&ristretto.Config[[]byte, treeReadmeCacheEntry]{ - NumCounters: 1e4, - MaxCost: 1 << 60, - BufferItems: 8192, - }) - if err != nil { - clog.Fatal(1, "Error initializing indexPageCache: "+err.Error()) - } -} diff --git a/cache_index_commits_display.go b/cache_index_commits_display.go deleted file mode 100644 index 54b3eab782a4344e91163b8056ca772ea32ffc4a..0000000000000000000000000000000000000000 --- a/cache_index_commits_display.go +++ /dev/null @@ -1,24 +0,0 @@ -// SPDX-License-Identifier: AGPL-3.0-only -// SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu - -package main - -import ( - "github.com/dgraph-io/ristretto/v2" - "go.lindenii.runxiyu.org/lindenii-common/clog" -) - -// The key is the commit ID raw hash. -var indexCommitsDisplayCache *ristretto.Cache[[]byte, []commitDisplayOld] - -func init() { - var err error - indexCommitsDisplayCache, err = ristretto.NewCache(&ristretto.Config[[]byte, []commitDisplayOld]{ - NumCounters: 1e4, - MaxCost: 1 << 60, - BufferItems: 8192, - }) - if err != nil { - clog.Fatal(1, "Error initializing indexCommitsCache: "+err.Error()) - } -} -- 2.48.1