redis

package
v0.0.0-...-79fabe2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Enumerator

func Enumerator(ctx context.Context, iter *redis.ScanIterator) *enumerator

NewPebbleEnumerator creates a new enumerator for a given Pebble iterator.

func NewRedisStore

func NewRedisStore(options *RedisOptions) (kv.KV, error)

NewRedisStore initializes a new Redis provider.

Types

type RedisOptions

type RedisOptions struct {
	Addr     string // e.g., "localhost:6379"
	Password string // Optional
	DB       int    // Redis database number (default 0)
	Prefix   string // Optional key prefix
}

RedisOptions holds configuration options for the Redis provider.

type Store

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

Store implements the kv.KV interface using Redis.

func (*Store) Batch

func (r *Store) Batch(ctx context.Context, items []*kv.BatchItem) error

Batch performs a batch of operations (not atomic in Redis).

func (*Store) BatchChunks

func (r *Store) BatchChunks(ctx context.Context, items enumerators.Enumerator[*kv.BatchItem], chunkSize int) error

BatchChunks processes batched items in chunks.

func (*Store) Clear

func (r *Store) Clear()

func (*Store) Close

func (r *Store) Close() error

Close releases resources.

func (*Store) Enumerate

func (r *Store) Enumerate(ctx context.Context, args kv.QueryArgs) enumerators.Enumerator[*kv.Item]

Enumerate returns an Enumerator for items matching the query args.

func (*Store) Get

func (r *Store) Get(ctx context.Context, pk lexkey.PrimaryKey) (*kv.Item, error)

Get retrieves an item by its PrimaryKey.

func (*Store) GetBatch

func (r *Store) GetBatch(ctx context.Context, keys ...lexkey.PrimaryKey) ([]*kv.Item, error)

GetBatch retrieves multiple items concurrently.

func (*Store) Put

func (r *Store) Put(ctx context.Context, item *kv.Item) error

Put inserts or updates an item.

func (*Store) Query

func (r *Store) Query(ctx context.Context, args kv.QueryArgs, sort kv.SortDirection) ([]*kv.Item, error)

Query retrieves items matching the query args with specified sorting.

func (*Store) Remove

func (r *Store) Remove(ctx context.Context, pk lexkey.PrimaryKey) error

Remove deletes an item by its PrimaryKey.

func (*Store) RemoveBatch

func (r *Store) RemoveBatch(ctx context.Context, keys ...lexkey.PrimaryKey) error

RemoveBatch deletes multiple items concurrently.

func (*Store) RemoveRange

func (r *Store) RemoveRange(ctx context.Context, rangeKey lexkey.RangeKey) error

RemoveRange removes items within a range (simulated with SCAN).

Jump to

Keyboard shortcuts

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