Documentation
¶
Overview ¶
Package redis holds the reference Kv and EventBus adapters over Redis (github.com/redis/go-redis/v9). Works against any Redis: local Docker, self-hosted, or managed.
Index ¶
- func ThreadChannel(threadID string) string
- type Bus
- type Kv
- func (k *Kv) Del(ctx context.Context, key string) error
- func (k *Kv) DelIfValue(ctx context.Context, key, expected string) (bool, error)
- func (k *Kv) Get(ctx context.Context, key string) (string, bool, error)
- func (k *Kv) Incr(ctx context.Context, key string) (int64, error)
- func (k *Kv) IncrWithExpiry(ctx context.Context, key string, ttl time.Duration) (int64, error)
- func (k *Kv) Set(ctx context.Context, key, value string, opts ports.SetOptions) (bool, error)
- func (k *Kv) SetIfValue(ctx context.Context, key, expected, value string, ttl time.Duration) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ThreadChannel ¶
ThreadChannel is the pub/sub channel for a thread's events. Shared with the Upstash adapter and the TypeScript package.
Types ¶
type Bus ¶
type Bus struct {
// contains filtered or unexported fields
}
Bus is an EventBus over Redis Pub/Sub.
While subscribed, it emits a bus-only HEARTBEAT notice (seq 0, never persisted) every heartbeat interval: the §2.5 watchdog pattern. Pub/sub is at-most-once, so a distributor treats heartbeats as a trigger to re-check for orphaned HITL waits.
func NewBus ¶
func NewBus(client goredis.UniversalClient, heartbeat time.Duration) *Bus
NewBus wraps a client. A zero heartbeat means one minute.
type Kv ¶
type Kv struct {
// contains filtered or unexported fields
}
Kv is a Kv over Redis.