redis

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package redis provides Redis-backed conversation storage. Use when using remote workers so the worker process can access conversation data. Agent and worker use the same Redis config; conversation ID is passed at runtime via Run and the agent run input.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*RedisConversation)

Option configures RedisConversation.

func WithAddr

func WithAddr(addr string) Option

WithAddr sets the Redis address (e.g. "localhost:6379").

func WithClient

func WithClient(client *redis.Client) Option

WithClient sets the Redis client. When set, addr/password/db are ignored. Close() will NOT close the client.

func WithDB

func WithDB(db int) Option

WithDB sets the Redis database number (default 0).

func WithKeyPrefix

func WithKeyPrefix(prefix string) Option

WithKeyPrefix sets the Redis key prefix.

func WithMaxSize

func WithMaxSize(size int) Option

WithMaxSize sets the maximum number of messages to store. Oldest are trimmed when exceeded.

func WithPassword

func WithPassword(password string) Option

WithPassword sets the Redis password.

func WithTTL

func WithTTL(ttl time.Duration) Option

WithTTL sets the Redis key TTL.

type RedisConversation

type RedisConversation struct {
	// contains filtered or unexported fields
}

func NewRedisConversation

func NewRedisConversation(opts ...Option) (*RedisConversation, error)

NewRedisConversation creates a Redis-backed conversation from options. Use WithClient to provide your own client; otherwise addr is required to create a client. Call Close() when done if you did not use WithClient.

func (*RedisConversation) AddMessage

func (c *RedisConversation) AddMessage(ctx context.Context, id string, msg interfaces.Message) error

func (*RedisConversation) Clear

func (c *RedisConversation) Clear(ctx context.Context, id string) error

func (*RedisConversation) Close

func (c *RedisConversation) Close() error

Close releases the Redis connection only when we own it (not using WithClient).

func (*RedisConversation) IsDistributed

func (c *RedisConversation) IsDistributed() bool

func (*RedisConversation) ListMessages

Jump to

Keyboard shortcuts

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