Skip to content

Commit c05ba13

Browse files
fix(deps): update module github.com/dgraph-io/ristretto to v2 (#1548)
* fix(deps): update module github.com/dgraph-io/ristretto to v2 * fix(deps): update module github.com/dgraph-io/ristretto to v2 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: carlobortolan <[email protected]>
1 parent 8659822 commit c05ba13

File tree

8 files changed

+725
-1194
lines changed

8 files changed

+725
-1194
lines changed

api/courses_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/TUM-Dev/gocast/model"
1515
"github.com/TUM-Dev/gocast/tools"
1616
"github.com/TUM-Dev/gocast/tools/testutils"
17-
"github.com/dgraph-io/ristretto"
17+
"github.com/dgraph-io/ristretto/v2"
1818
"github.com/gin-gonic/gin"
1919
"github.com/golang/mock/gomock"
2020
"github.com/matthiasreumann/gomino"
@@ -29,14 +29,14 @@ func CourseRouterWrapper(r *gin.Engine) {
2929
func TestCoursesCRUD(t *testing.T) {
3030
gin.SetMode(gin.TestMode)
3131

32-
cache, _ := ristretto.NewCache(&ristretto.Config{
32+
cache, _ := ristretto.NewCache[string, any](&ristretto.Config[string, any]{
3333
NumCounters: 1e7, // number of keys to track frequency of (10M).
3434
MaxCost: 1 << 30, // maximum cost of cache (1GB).
3535
BufferItems: 64, // number of keys per Get buffer.
3636
Metrics: true,
3737
})
3838

39-
dao.Cache = *cache
39+
dao.Cache = cache
4040

4141
t.Run("GET/api/courses/live", func(t *testing.T) {
4242
url := "/api/courses/live"

cmd/tumlive/tumlive.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313

1414
"github.com/soheilhy/cmux"
1515

16-
"github.com/dgraph-io/ristretto"
16+
"github.com/dgraph-io/ristretto/v2"
1717
"github.com/getsentry/sentry-go"
1818
sentrygin "github.com/getsentry/sentry-go/gin"
1919
"github.com/gin-contrib/gzip"
@@ -224,7 +224,7 @@ func main() {
224224
return
225225
}
226226

227-
cache, err := ristretto.NewCache(&ristretto.Config{
227+
cache, _ := ristretto.NewCache[string, any](&ristretto.Config[string, any]{
228228
NumCounters: 1e7, // number of keys to track frequency of (10M).
229229
MaxCost: 1 << 30, // maximum cost of cache (1GB).
230230
BufferItems: 64, // number of keys per Get buffer.
@@ -235,7 +235,7 @@ func main() {
235235
sentry.Flush(time.Second * 5)
236236
logger.Error("Error risretto.NewCache", "err", err)
237237
}
238-
dao.Cache = *cache
238+
dao.Cache = cache
239239

240240
m := runner_manager.New(dao.NewDaoWrapper())
241241
log.Info("running runner manager")

dao/cache.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package dao
22

3-
import "github.com/dgraph-io/ristretto"
3+
import "github.com/dgraph-io/ristretto/v2"
44

5-
var Cache ristretto.Cache
5+
var Cache *ristretto.Cache[string, any]

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ require (
4141
github.com/TUM-Dev/CampusProxy/client v0.0.0-20230226120508-3e8bb2411921
4242
github.com/TUM-Dev/gocast/worker v0.0.0-20250110151606-bd9f2b63e789
4343
github.com/asticode/go-astisub v0.34.0
44-
github.com/dgraph-io/ristretto v0.2.0
44+
github.com/dgraph-io/ristretto/v2 v2.1.0
4545
github.com/getsentry/sentry-go/gin v0.31.1
4646
github.com/golang-jwt/jwt/v5 v5.2.2
4747
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3
@@ -70,6 +70,7 @@ require (
7070
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
7171
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
7272
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
73+
github.com/golang/glog v1.2.4 // indirect
7374
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect
7475
github.com/josharian/intern v1.0.0 // indirect
7576
github.com/klauspost/cpuid/v2 v2.2.9 // indirect

go.sum

Lines changed: 3 additions & 108 deletions
Large diffs are not rendered by default.

go.work.sum

Lines changed: 707 additions & 0 deletions
Large diffs are not rendered by default.

tools/cache.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ package tools
33
import (
44
"time"
55

6-
"github.com/dgraph-io/ristretto"
6+
"github.com/dgraph-io/ristretto/v2"
77
)
88

9-
var cache *ristretto.Cache
9+
var cache *ristretto.Cache[string, any]
1010

1111
func initCache() {
12-
c, err := ristretto.NewCache(&ristretto.Config{
13-
NumCounters: 1e6, // number of keys to track frequency of (1M).
14-
MaxCost: 1 << 29, // 1 << 29 == 1/2GB Cost of cache
12+
c, err := ristretto.NewCache[string, any](&ristretto.Config[string, any]{
13+
NumCounters: 1e6,
14+
MaxCost: 1 << 29,
1515
BufferItems: 64,
1616
})
1717
if err != nil {

worker/go.sum

Lines changed: 0 additions & 1072 deletions
This file was deleted.

0 commit comments

Comments
 (0)