goredis

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2023 License: MIT Imports: 3 Imported by: 0

README

redigo

An officially supported adapter compatible with go-redis

Usage

Usage

package main

import (
	"github.com/aidenwallis/go-ratelimiting/redis"
	adapter "github.com/aidenwallis/go-ratelimiting/redis/adapters/go-redis"
	goredis "github.com/redis/go-redis/v9"
)

func main() {
	client := goredis.NewClient(&redis.Options{Addr: "127.0.0.1:6379"})
	ratelimiter := redis.NewLeakyBucket(adapter.NewAdapter(client))
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	Client *redis.Client
}

Adapter is a go-redis implementation compatible with github.com/aidenwallis/go-ratelimiting/redis/adapters

func NewAdapter

func NewAdapter(client *redis.Client) *Adapter

NewAdapter creates a new adapter using the go-redis client.

func (*Adapter) Eval

func (a *Adapter) Eval(ctx context.Context, script string, keys []string, args []interface{}) (interface{}, error)

Eval defines adapter compatibility for the redis EVAL command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL