redis

package
v0.1.562 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type Blackbox

type Blackbox interface {
	// contains filtered or unexported methods
}

type Client

type Client interface {
	Blackbox
	contract.RedisOperator
}

func NewClient

func NewClient(d Dependencies, opts ClientOptions) (Client, error)

func NewNoopClient added in v0.1.83

func NewNoopClient() Client

type ClientOption

type ClientOption func(*ClientOptions)

func WithBatchSize

func WithBatchSize(x int) ClientOption

func WithExpiresAfter

func WithExpiresAfter(x time.Duration) ClientOption

type ClientOptions

type ClientOptions struct {
	ExpiresAfter time.Duration
	BatchSize    int
}

func ApplyClientOptions

func ApplyClientOptions(opts *ClientOptions, modifiers ...ClientOption) ClientOptions

type DefaultTool added in v0.1.11

type DefaultTool struct {
	T *contract.Tool[Client]
}

func NewTool added in v0.1.10

func NewTool(c Client, opts contract.ToolOptions[Client]) *DefaultTool

func (*DefaultTool) BatchFlush added in v0.1.11

func (d *DefaultTool) BatchFlush(ctx context.Context, keys []fmt.Stringer) error

BatchFlush removes multiple specific keys from Redis.

func (*DefaultTool) BatchGet added in v0.1.11

func (d *DefaultTool) BatchGet(ctx context.Context, keys []fmt.Stringer) ([]contract.CacheHit, error)

BatchGet retrieves multiple values from Redis by keys.

func (*DefaultTool) BatchSet added in v0.1.11

func (d *DefaultTool) BatchSet(ctx context.Context, entries map[fmt.Stringer]contract.CacheHit) error

BatchSet stores multiple key-value pairs in Redis.

func (*DefaultTool) Close added in v0.1.13

func (d *DefaultTool) Close(ctx context.Context) error

Close closes the underlying client.

func (*DefaultTool) Exists added in v0.1.11

func (d *DefaultTool) Exists(ctx context.Context, key fmt.Stringer) (bool, error)

Exists checks if a key exists in Redis.

func (*DefaultTool) Flush added in v0.1.11

func (d *DefaultTool) Flush(ctx context.Context, pattern fmt.Stringer) error

Flush removes all keys matching the given pattern from Redis.

func (*DefaultTool) FlushAll added in v0.1.11

func (d *DefaultTool) FlushAll(ctx context.Context) error

FlushAll removes all entries from Redis.

func (*DefaultTool) Get added in v0.1.11

Get retrieves a value from Redis by key.

func (*DefaultTool) Set added in v0.1.11

func (d *DefaultTool) Set(ctx context.Context, key fmt.Stringer, value contract.CacheHit) error

Set stores a value in Redis for a given key.

type Dependencies added in v0.1.8

type Dependencies struct {
	C contract.RedisClient
}

type Loaded added in v0.1.122

type Loaded struct {
	Username string
	Password string
}

type RedisClientDependencies added in v0.1.14

type RedisClientDependencies struct {
	C contract.CertGenerator
	F contract.FSysFileReader
}

type RedisClientOptions

type RedisClientOptions struct {
	Loaded
	FS        fs.ReadFileFS
	Port      int
	Host      string
	CertPath  string
	KeyPath   string
	CAPath    string
	UseTLS    bool
	MutualTLS bool
}

type Tool added in v0.1.245

type Tool interface {
	contract.RedisOperator
}

Jump to

Keyboard shortcuts

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