21 lines
536 B
Go
21 lines
536 B
Go
package ratelimit
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/redis/go-redis/v9"
|
|
)
|
|
|
|
// GoRedis bridges *redis.Client to the ScriptRunner interface.
|
|
//
|
|
// Kept in its own file, and as thin as possible, because it is the one piece
|
|
// here that cannot be exercised without a live Redis: everything in redis.go is
|
|
// tested against a fake.
|
|
type GoRedis struct {
|
|
Client *redis.Client
|
|
}
|
|
|
|
func (g GoRedis) Eval(ctx context.Context, script string, keys []string, args ...any) (any, error) {
|
|
return g.Client.Eval(ctx, script, keys, args...).Result()
|
|
}
|