diff options
author | Alessio Caiazza <acaiazza@gitlab.com> | 2023-11-14 23:29:35 +0300 |
---|---|---|
committer | Alessio Caiazza <acaiazza@gitlab.com> | 2023-11-14 23:29:35 +0300 |
commit | 4037db271d552bd61f83abc6d366f33b23e9a302 (patch) | |
tree | c30e71ff937e33cf19b463776d8f557c576cc939 | |
parent | dceac124eba93ceb3a12fb31cec49e4c51222858 (diff) | |
parent | 682415d166b44b2ae6ca1904b5849b32d63396c2 (diff) |
Merge branch 'upgrade-ccache-v3' into 'master'
Update module github.com/karlseguin/ccache/v2 to v3
See merge request https://gitlab.com/gitlab-org/gitlab-pages/-/merge_requests/920
Merged-by: Alessio Caiazza <acaiazza@gitlab.com>
Approved-by: Alessio Caiazza <acaiazza@gitlab.com>
Reviewed-by: Naman Jagdish Gala <ngala@gitlab.com>
Co-authored-by: Jaime Martinez <jmartinez@gitlab.com>
Co-authored-by: GitLab Renovate Bot <gitlab-bot@gitlab.com>
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | go.sum | 8 | ||||
-rw-r--r-- | internal/lru/lru.go | 10 | ||||
-rw-r--r-- | internal/vfs/zip/vfs.go | 2 |
4 files changed, 9 insertions, 13 deletions
@@ -15,7 +15,7 @@ require ( github.com/gorilla/securecookie v1.1.1 github.com/gorilla/sessions v1.2.1 github.com/hashicorp/go-multierror v1.1.1 - github.com/karlseguin/ccache/v2 v2.0.8 + github.com/karlseguin/ccache/v3 v3.0.5 github.com/namsral/flag v1.7.4-pre github.com/patrickmn/go-cache v2.1.0+incompatible github.com/pires/go-proxyproto v0.7.0 @@ -183,10 +183,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/karlseguin/ccache/v2 v2.0.8 h1:lT38cE//uyf6KcFok0rlgXtGFBWxkI6h/qg4tbFyDnA= -github.com/karlseguin/ccache/v2 v2.0.8/go.mod h1:2BDThcfQMf/c0jnZowt16eW405XIqZPavt+HoYEtcxQ= -github.com/karlseguin/expect v1.0.2-0.20190806010014-778a5f0c6003 h1:vJ0Snvo+SLMY72r5J4sEfkuE7AFbixEP2qRbEcum/wA= -github.com/karlseguin/expect v1.0.2-0.20190806010014-778a5f0c6003/go.mod h1:zNBxMY8P21owkeogJELCLeHIt+voOSduHYTFUbwRAV8= +github.com/karlseguin/ccache/v3 v3.0.5 h1:hFX25+fxzNjsRlREYsoGNa2LoVEw5mPF8wkWq/UnevQ= +github.com/karlseguin/ccache/v3 v3.0.5/go.mod h1:qxC372+Qn+IBj8Pe3KvGjHPj0sWwEF7AeZVhsNPZ6uY= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -241,8 +239,6 @@ github.com/tj/assert v0.0.3 h1:Df/BlaZ20mq6kuai7f5z2TvPFiwC3xaWJSDQNiIS3Rk= github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk= github.com/tj/go-redirects v0.0.0-20200911105812-fd1ba1020b37 h1:K11tjwz8zTTSZkz4TUjfLN+y8uJWP38BbyPqZ2yB/Yk= github.com/tj/go-redirects v0.0.0-20200911105812-fd1ba1020b37/go.mod h1:E0E2H2gQA+uoi27VCSU+a/BULPtadQA78q3cpTjZbZw= -github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0 h1:3UeQBvD0TFrlVjOeLOBz+CPAI8dnbqNSVwUwRrkp7vQ= -github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0/go.mod h1:IXCdmsXIht47RaVFLEdVnh1t+pgYtTAhQGj73kz+2DM= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/internal/lru/lru.go b/internal/lru/lru.go index dafb5347..1069bd7f 100644 --- a/internal/lru/lru.go +++ b/internal/lru/lru.go @@ -3,7 +3,7 @@ package lru import ( "time" - "github.com/karlseguin/ccache/v2" + "github.com/karlseguin/ccache/v3" "github.com/prometheus/client_golang/prometheus" ) @@ -30,7 +30,7 @@ type Cache struct { op string duration time.Duration maxSize int64 - cache *ccache.Cache + cache *ccache.Cache[any] metricCachedEntries *prometheus.GaugeVec metricCacheRequests *prometheus.CounterVec } @@ -47,11 +47,11 @@ func New(op string, opts ...Option) *Cache { opt(c) } - configuration := ccache.Configure() + configuration := ccache.Configure[any]() configuration.MaxSize(c.maxSize) configuration.ItemsToPrune(uint32(c.maxSize) / itemsToPruneDiv) configuration.GetsPerPromote(getsPerPromote) // if item gets requested frequently promote it - configuration.OnDelete(func(*ccache.Item) { + configuration.OnDelete(func(*ccache.Item[any]) { if c.metricCachedEntries != nil { c.metricCachedEntries.WithLabelValues(op).Dec() } @@ -64,7 +64,7 @@ func New(op string, opts ...Option) *Cache { // FindOrFetch will try to get the item from the cache if exists and is not expired. // If it can't find it, it will call fetchFn to retrieve the item and cache it. -func (c *Cache) FindOrFetch(cacheNamespace, key string, fetchFn func() (interface{}, error)) (interface{}, error) { +func (c *Cache) FindOrFetch(cacheNamespace, key string, fetchFn func() (any, error)) (any, error) { item := c.cache.Get(cacheNamespace + key) if item != nil && !item.Expired() { diff --git a/internal/vfs/zip/vfs.go b/internal/vfs/zip/vfs.go index 6b42e627..b2207bba 100644 --- a/internal/vfs/zip/vfs.go +++ b/internal/vfs/zip/vfs.go @@ -38,7 +38,7 @@ var ( ) type lruCache interface { - FindOrFetch(cacheNamespace, key string, fetchFn func() (interface{}, error)) (interface{}, error) + FindOrFetch(cacheNamespace, key string, fetchFn func() (any, error)) (any, error) } // zipVFS is a simple cached implementation of the vfs.VFS interface |