diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-04-13 16:38:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-13 08:38:44 +0000 |
commit | c248f010ad08a7017ba1d418e9b6a5b72aff0c88 (patch) | |
tree | 4e479229bc1248e123f2ed9296edf80fe96cdd65 /services/context/api.go | |
parent | 8fd8978b4934865c2b041216e84e923ad574a4c7 (diff) | |
download | gitea-c248f010ad08a7017ba1d418e9b6a5b72aff0c88.tar.gz gitea-c248f010ad08a7017ba1d418e9b6a5b72aff0c88.zip |
Refactor cache and disable go-chi cache (#30417)
use built-in cache package to wrap external go-chi cache package
Diffstat (limited to 'services/context/api.go')
-rw-r--r-- | services/context/api.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/services/context/api.go b/services/context/api.go index b18a206b5e..c684add297 100644 --- a/services/context/api.go +++ b/services/context/api.go @@ -13,7 +13,7 @@ import ( "code.gitea.io/gitea/models/unit" user_model "code.gitea.io/gitea/models/user" - mc "code.gitea.io/gitea/modules/cache" + "code.gitea.io/gitea/modules/cache" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/gitrepo" "code.gitea.io/gitea/modules/httpcache" @@ -21,15 +21,13 @@ import ( "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/web" web_types "code.gitea.io/gitea/modules/web/types" - - "gitea.com/go-chi/cache" ) // APIContext is a specific context for API service type APIContext struct { *Base - Cache cache.Cache + Cache cache.StringCache Doer *user_model.User // current signed-in user IsSigned bool @@ -217,7 +215,7 @@ func APIContexter() func(http.Handler) http.Handler { base, baseCleanUp := NewBaseContext(w, req) ctx := &APIContext{ Base: base, - Cache: mc.GetCache(), + Cache: cache.GetCache(), Repo: &Repository{PullRequest: &PullRequest{}}, Org: &APIOrganization{}, } |