Redis

redis

github.com/go-redsync/redsync/v4/redis

import "github.com/go-redsync/redsync/v4/redis"

Functions

func NewScript(keyCount int, src, hash string) *Script

Source: redis/redis.go:38

NewScript returns a new script object. If keyCount is greater than or equal to zero, then the count is automatically inserted in the EVAL command argument list. If keyCount is less than zero, then the application supplies the count as the first value in the keysAndArgs argument to the Do, Send and SendHash methods. Taken from https://github.com/gomodule/redigo/blob/46992b0f02f74066bcdfd9b03e33bc03abd10dc7/redis/script.go#L32-L41

Types

type Conn

Source: redis/redis.go:14

Conn is a single Redis connection.

type Conn interface {
	Get(name string) (string, error)
	Set(name string, value string) (bool, error)
	SetNX(name string, value string, expiry time.Duration) (bool, error)
	Eval(script *Script, keysAndArgs ...any) (any, error)
	ScriptLoad(script *Script) error
	PTTL(name string) (time.Duration, error)
	Close() error
}
Methods
  • Get func(name string) (string, error)
  • Set func(name string, value string) (bool, error)
  • SetNX func(name string, value string, expiry time.Duration) (bool, error)
  • Eval func(script *Script, keysAndArgs ...any) (any, error)
  • ScriptLoad func(script *Script) error
  • PTTL func(name string) (time.Duration, error)
  • Close func() error

type Pool

Source: redis/redis.go:9

Pool maintains a pool of Redis connections.

type Pool interface {
	Get(ctx context.Context) (Conn, error)
}
Methods
  • Get func(ctx context.Context) (Conn, error)

type Script

Source: redis/redis.go:26

Script encapsulates the source, hash and key count for a Lua script. Taken from https://github.com/gomodule/redigo/blob/46992b0f02f74066bcdfd9b03e33bc03abd10dc7/redis/script.go#L24-L30

type Script struct {
	KeyCount int
	Src      string
	Hash     string
}
Fields
  • KeyCount int
  • Src string
  • Hash string