Skip to content

Commit

Permalink
Upgrade go-redis
Browse files Browse the repository at this point in the history
  • Loading branch information
yosiat committed Jan 23, 2024
1 parent bfed31b commit 4da6311
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 50 deletions.
2 changes: 1 addition & 1 deletion algorithm/cloudflare/redis_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"time"

"github.com/go-redis/redis/v8"
"github.com/redis/go-redis/v9"

"github.com/bringg/go_redis_ratelimit/algorithm"
)
Expand Down
2 changes: 1 addition & 1 deletion algorithm/gcra/gcra.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package gcra
import (
"context"

"github.com/go-redis/redis_rate/v9"
"github.com/go-redis/redis_rate/v10"

"github.com/bringg/go_redis_ratelimit/algorithm"
)
Expand Down
7 changes: 5 additions & 2 deletions algorithm/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"time"

"github.com/go-redis/redis/v8"
"github.com/redis/go-redis/v9"
)

var Registry []*RegInfo
Expand All @@ -25,13 +25,16 @@ type (
Del(ctx context.Context, keys ...string) *redis.IntCmd
ScriptLoad(ctx context.Context, script string) *redis.StringCmd
ScriptExists(ctx context.Context, hashes ...string) *redis.BoolSliceCmd
ZAdd(ctx context.Context, key string, members ...*redis.Z) *redis.IntCmd
ZAdd(ctx context.Context, key string, members ...redis.Z) *redis.IntCmd
Expire(ctx context.Context, key string, expiration time.Duration) *redis.BoolCmd
ZRemRangeByScore(ctx context.Context, key string, min string, max string) *redis.IntCmd
Eval(ctx context.Context, script string, keys []string, args ...interface{}) *redis.Cmd
EvalSha(ctx context.Context, sha1 string, keys []string, args ...interface{}) *redis.Cmd
TxPipelined(ctx context.Context, fn func(pipe redis.Pipeliner) error) ([]redis.Cmder, error)
ZRangeByScoreWithScores(ctx context.Context, key string, opt *redis.ZRangeBy) *redis.ZSliceCmd

EvalRO(ctx context.Context, script string, keys []string, args ...interface{}) *redis.Cmd
EvalShaRO(ctx context.Context, sha1 string, keys []string, args ...interface{}) *redis.Cmd
}

Algorithm interface {
Expand Down
2 changes: 1 addition & 1 deletion algorithm/sliding_window/sliding_window_lua.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package sliding_window

import "github.com/go-redis/redis/v8"
import "github.com/redis/go-redis/v9"

var script = redis.NewScript(`
-- this script has side-effects, so it requires replicate commands mode
Expand Down
4 changes: 2 additions & 2 deletions algorithm/sliding_window/v2/sliding_window.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strconv"
"time"

"github.com/go-redis/redis/v8"
"github.com/redis/go-redis/v9"

"github.com/bringg/go_redis_ratelimit/algorithm"
)
Expand Down Expand Up @@ -57,7 +57,7 @@ func (c *SlidingWindow) Allow() (r *algorithm.Result, err error) {
if err := pipe.ZAdd(
ctx,
c.key,
&redis.Z{
redis.Z{
Member: nowNanos,
Score: float64(nowNanos),
},
Expand Down
2 changes: 1 addition & 1 deletion examples/cloudflare/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"log"
"time"

"github.com/go-redis/redis/v8"
"github.com/redis/go-redis/v9"

limiter "github.com/bringg/go_redis_ratelimit"
"github.com/bringg/go_redis_ratelimit/algorithm/cloudflare"
Expand Down
2 changes: 1 addition & 1 deletion examples/gcra/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"log"
"time"

"github.com/go-redis/redis/v8"
"github.com/redis/go-redis/v9"

"github.com/bringg/go_redis_ratelimit"
"github.com/bringg/go_redis_ratelimit/algorithm/gcra"
Expand Down
2 changes: 1 addition & 1 deletion examples/sliding_window/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"log"
"time"

"github.com/go-redis/redis/v8"
"github.com/redis/go-redis/v9"

"github.com/bringg/go_redis_ratelimit"
"github.com/bringg/go_redis_ratelimit/algorithm/sliding_window"
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ go 1.21
require (
github.com/alicebob/miniredis/v2 v2.31.1
github.com/coinpaprika/ratelimiter v0.2.1
github.com/go-redis/redis/v8 v8.11.4
github.com/go-redis/redis_rate/v9 v9.1.2
github.com/go-redis/redis_rate/v10 v10.0.1
github.com/golangci/golangci-lint v1.55.2
github.com/redis/go-redis/v9 v9.4.0
github.com/stretchr/testify v1.8.4
gotest.tools/gotestsum v1.11.0
)
Expand Down Expand Up @@ -43,7 +43,7 @@ require (
github.com/butuzov/mirror v1.1.0 // indirect
github.com/catenacyber/perfsprint v0.2.0 // indirect
github.com/ccojocar/zxcvbn-go v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/charithe/durationcheck v0.0.10 // indirect
github.com/chavacava/garif v0.1.0 // indirect
github.com/curioswitch/go-reassign v0.2.0 // indirect
Expand Down
45 changes: 10 additions & 35 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion limiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package go_redis_ratelimit
import (
"errors"

"github.com/go-redis/redis/v8"
"github.com/redis/go-redis/v9"

"github.com/bringg/go_redis_ratelimit/algorithm"
_ "github.com/bringg/go_redis_ratelimit/algorithm/all"
Expand Down
2 changes: 1 addition & 1 deletion limiter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

"github.com/alicebob/miniredis/v2"
"github.com/go-redis/redis/v8"
"github.com/redis/go-redis/v9"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down

0 comments on commit 4da6311

Please sign in to comment.