Documentation
¶
Overview ¶
Package storage provides a key-value storage abstraction layer with support for multiple backend implementations including embedded and distributed stores.
Package storage provides a key-value storage abstraction layer with support for multiple backend implementations including embedded and distributed stores.
Index ¶
- Constants
- Variables
- func Deserialize(data []byte, v any) error
- func DeserializeInt64(data []byte) (int64, error)
- func DeserializeString(data []byte) string
- func Serialize(v any) ([]byte, error)
- func SerializeInt64(n int64) []byte
- func SerializeString(s string) []byte
- type BadgerConfig
- type BadgerStore
- func (s *BadgerStore) Backup(_ context.Context, path string) error
- func (s *BadgerStore) BatchDelete(_ context.Context, keys []string) error
- func (s *BadgerStore) BatchGet(_ context.Context, keys []string) (map[string][]byte, error)
- func (s *BadgerStore) BatchSet(_ context.Context, items map[string][]byte) error
- func (s *BadgerStore) BatchSetWithTTL(_ context.Context, items map[string][]byte, ttl time.Duration) error
- func (s *BadgerStore) BeginTransaction(_ context.Context) (Transaction, error)
- func (s *BadgerStore) Close() error
- func (s *BadgerStore) CompareAndSwap(ctx context.Context, key string, old, newValue []byte) error
- func (s *BadgerStore) CompareAndSwapBatch(_ context.Context, mutations []CompareAndSwapMutation) error
- func (s *BadgerStore) Decrement(ctx context.Context, key string, delta int64) (int64, error)
- func (s *BadgerStore) Delete(_ context.Context, key string) error
- func (s *BadgerStore) Exists(_ context.Context, key string) (bool, error)
- func (s *BadgerStore) ExpireAt(ctx context.Context, key string, expireAt time.Time) error
- func (s *BadgerStore) Get(_ context.Context, key string) ([]byte, error)
- func (s *BadgerStore) GetTTL(_ context.Context, key string) (time.Duration, error)
- func (s *BadgerStore) Increment(_ context.Context, key string, delta int64) (int64, error)
- func (s *BadgerStore) Ping(ctx context.Context) error
- func (s *BadgerStore) Restore(_ context.Context, path string) error
- func (s *BadgerStore) Scan(_ context.Context, pattern string, limit int) ([]string, error)
- func (s *BadgerStore) ScanWithPrefix(_ context.Context, prefix string, limit int) ([]string, error)
- func (s *BadgerStore) Set(_ context.Context, key string, value []byte) error
- func (s *BadgerStore) SetWithTTL(_ context.Context, key string, value []byte, ttl time.Duration) error
- type BadgerTransaction
- func (t *BadgerTransaction) Commit(_ context.Context) error
- func (t *BadgerTransaction) CompareAndSwap(key string, old, newValue []byte) error
- func (t *BadgerTransaction) Delete(key string) error
- func (t *BadgerTransaction) Get(key string) ([]byte, error)
- func (t *BadgerTransaction) Increment(key string, delta int64) (int64, error)
- func (t *BadgerTransaction) Rollback() error
- func (t *BadgerTransaction) Set(key string, value []byte) error
- func (t *BadgerTransaction) SetWithTTL(key string, value []byte, ttl time.Duration) error
- type CompareAndSwapMutation
- type Config
- type KVStore
- type MockStore
- func (m *MockStore) BatchDelete(ctx context.Context, keys []string) error
- func (m *MockStore) BatchGet(ctx context.Context, keys []string) (map[string][]byte, error)
- func (m *MockStore) BatchSet(ctx context.Context, items map[string][]byte) error
- func (m *MockStore) BatchSetWithTTL(ctx context.Context, items map[string][]byte, ttl time.Duration) error
- func (m *MockStore) BeginTransaction(ctx context.Context) (Transaction, error)
- func (m *MockStore) Close() error
- func (m *MockStore) CompareAndSwap(ctx context.Context, key string, old, newValue []byte) error
- func (m *MockStore) CompareAndSwapBatch(ctx context.Context, mutations []CompareAndSwapMutation) error
- func (m *MockStore) Decrement(ctx context.Context, key string, delta int64) (int64, error)
- func (m *MockStore) Delete(ctx context.Context, key string) error
- func (m *MockStore) Exists(ctx context.Context, key string) (bool, error)
- func (m *MockStore) ExpireAt(ctx context.Context, key string, expireAt time.Time) error
- func (m *MockStore) Get(ctx context.Context, key string) ([]byte, error)
- func (m *MockStore) GetTTL(ctx context.Context, key string) (time.Duration, error)
- func (m *MockStore) Increment(ctx context.Context, key string, delta int64) (int64, error)
- func (m *MockStore) Ping(ctx context.Context) error
- func (m *MockStore) Scan(ctx context.Context, pattern string, limit int) ([]string, error)
- func (m *MockStore) ScanWithPrefix(ctx context.Context, prefix string, limit int) ([]string, error)
- func (m *MockStore) Set(ctx context.Context, key string, value []byte) error
- func (m *MockStore) SetWithTTL(ctx context.Context, key string, value []byte, ttl time.Duration) error
- type MockTransaction
- func (t *MockTransaction) Commit(_ context.Context) error
- func (t *MockTransaction) CompareAndSwap(key string, old, newValue []byte) error
- func (t *MockTransaction) Delete(key string) error
- func (t *MockTransaction) Get(key string) ([]byte, error)
- func (t *MockTransaction) Increment(key string, delta int64) (int64, error)
- func (t *MockTransaction) Rollback() error
- func (t *MockTransaction) Set(key string, value []byte) error
- func (t *MockTransaction) SetWithTTL(key string, value []byte, ttl time.Duration) error
- type PubSubClient
- type PubSubProvider
- type Transaction
- type ValkeyConfig
- type ValkeyPubSub
- type ValkeyStore
- func (v *ValkeyStore) BatchDelete(ctx context.Context, keys []string) error
- func (v *ValkeyStore) BatchGet(ctx context.Context, keys []string) (map[string][]byte, error)
- func (v *ValkeyStore) BatchSet(ctx context.Context, items map[string][]byte) error
- func (v *ValkeyStore) BatchSetWithTTL(ctx context.Context, items map[string][]byte, ttl time.Duration) error
- func (v *ValkeyStore) BeginTransaction(ctx context.Context) (Transaction, error)
- func (v *ValkeyStore) Close() error
- func (v *ValkeyStore) CompareAndSwap(ctx context.Context, key string, old, newValue []byte) error
- func (v *ValkeyStore) CompareAndSwapBatch(ctx context.Context, mutations []CompareAndSwapMutation) error
- func (v *ValkeyStore) Decrement(ctx context.Context, key string, delta int64) (int64, error)
- func (v *ValkeyStore) Delete(ctx context.Context, key string) error
- func (v *ValkeyStore) Exists(ctx context.Context, key string) (bool, error)
- func (v *ValkeyStore) ExpireAt(ctx context.Context, key string, expireAt time.Time) error
- func (v *ValkeyStore) Get(ctx context.Context, key string) ([]byte, error)
- func (v *ValkeyStore) GetPubSub() PubSubClient
- func (v *ValkeyStore) GetTTL(ctx context.Context, key string) (time.Duration, error)
- func (v *ValkeyStore) Increment(ctx context.Context, key string, delta int64) (int64, error)
- func (v *ValkeyStore) Ping(ctx context.Context) error
- func (v *ValkeyStore) Scan(ctx context.Context, pattern string, limit int) ([]string, error)
- func (v *ValkeyStore) ScanWithPrefix(ctx context.Context, prefix string, limit int) ([]string, error)
- func (v *ValkeyStore) Set(ctx context.Context, key string, value []byte) error
- func (v *ValkeyStore) SetWithTTL(ctx context.Context, key string, value []byte, ttl time.Duration) error
- type ValkeyTransaction
- func (t *ValkeyTransaction) Commit(ctx context.Context) error
- func (t *ValkeyTransaction) CompareAndSwap(key string, _, newValue []byte) error
- func (t *ValkeyTransaction) Delete(key string) error
- func (t *ValkeyTransaction) Get(key string) ([]byte, error)
- func (t *ValkeyTransaction) Increment(key string, delta int64) (int64, error)
- func (t *ValkeyTransaction) Rollback() error
- func (t *ValkeyTransaction) Set(key string, value []byte) error
- func (t *ValkeyTransaction) SetWithTTL(key string, value []byte, ttl time.Duration) error
Constants ¶
const ( // StorageTypeBadger represents the Badger embedded storage backend StorageTypeBadger = "badger" // StorageTypeValkey represents the Valkey distributed storage backend StorageTypeValkey = "valkey" )
Storage backend type constants
const KeyPrefixExtraction = "extraction:"
KeyPrefixExtraction is the prefix for cached document text. A parser engine writes here and the response cache writes above, and the two never share a key: one holds what a model answered, and this one holds what a document says.
const KeyPrefixResponse = "response:"
KeyPrefixResponse is the prefix for cached responses. The response cache manager composes record keys from it; Starmap owns model and provider facts, so no model metadata is keyed here.
Variables ¶
var ( // ErrTransactionClosed is returned when operations are attempted on a closed transaction ErrTransactionClosed = errors.New("transaction is closed") // ErrTransactionCommitted is returned when operations are attempted on a committed transaction ErrTransactionCommitted = errors.New("transaction already committed") // ErrTransactionRolledBack is returned when operations are attempted on a rolled back transaction ErrTransactionRolledBack = errors.New("transaction already rolled back") // PubSub-related errors // ErrPubSubClosed is returned when operations are attempted on a closed PubSub client ErrPubSubClosed = errors.New("pubsub client is closed") )
Transaction-related errors
var ( // ErrNotFound is returned when a key does not exist ErrNotFound = errors.New("key not found") // ErrConflict is returned when a write conflict occurs (e.g., CAS mismatch) ErrConflict = errors.New("write conflict") // ErrInvalidKey is returned when an invalid key is provided ErrInvalidKey = errors.New("invalid key") // ErrInvalidMutation is returned when an atomic mutation set is malformed. ErrInvalidMutation = errors.New("invalid compare-and-swap mutation") // ErrStorageClosed is returned when operations are attempted on a closed store ErrStorageClosed = errors.New("storage closed") // ErrReadOnly is returned when a write is attempted through a read-only store. ErrReadOnly = errors.New("storage is read-only") // ErrReadOnlyRecoveryRequired means that a non-mutating inspection cannot // open storage until the normal writable startup performs recovery. ErrReadOnlyRecoveryRequired = errors.New("storage recovery is required before read-only inspection") // ErrReadOnlyUnsupported means that the storage backend cannot provide a // non-mutating inspection on the current platform. ErrReadOnlyUnsupported = errors.New("read-only storage inspection is unsupported") // ErrTimeout is returned when an operation times out ErrTimeout = errors.New("operation timeout") )
Common errors returned by storage operations
Functions ¶
func Deserialize ¶
Deserialize converts bytes to the specified type using JSON decoding
func DeserializeInt64 ¶
DeserializeInt64 converts bytes to int64
func DeserializeString ¶
DeserializeString converts bytes to string
func SerializeString ¶
SerializeString converts a string to bytes
Types ¶
type BadgerConfig ¶
type BadgerConfig struct {
Path string `env:"PATH,default=./data/badger"`
InMemory bool
SyncWrites bool `env:"SYNC_WRITES,default=false"`
Compression bool `env:"COMPRESSION,default=true"`
NumVersions int `env:"NUM_VERSIONS,default=1"`
NumLevelZero int `env:"NUM_LEVEL_ZERO,default=5"`
MemTableSize int64 `env:"MEM_TABLE_SIZE,default=67108864"` // 64MB
}
BadgerConfig represents Badger-specific configuration
type BadgerStore ¶
type BadgerStore struct {
// contains filtered or unexported fields
}
BadgerStore implements the KVStore interface using Badger DB
func OpenBadger ¶
func OpenBadger(config BadgerConfig) (*BadgerStore, error)
OpenBadger creates a new BadgerStore instance with the given configuration
func OpenBadgerReadOnly ¶ added in v1.0.1
func OpenBadgerReadOnly(config BadgerConfig) (*BadgerStore, error)
OpenBadgerReadOnly opens an existing Badger database without background maintenance or filesystem creation.
func (*BadgerStore) Backup ¶
func (s *BadgerStore) Backup(_ context.Context, path string) error
Backup creates a backup of the database
func (*BadgerStore) BatchDelete ¶
func (s *BadgerStore) BatchDelete(_ context.Context, keys []string) error
BatchDelete removes multiple keys
func (*BadgerStore) BatchSetWithTTL ¶
func (s *BadgerStore) BatchSetWithTTL(_ context.Context, items map[string][]byte, ttl time.Duration) error
BatchSetWithTTL stores multiple key-value pairs with TTL
func (*BadgerStore) BeginTransaction ¶
func (s *BadgerStore) BeginTransaction(_ context.Context) (Transaction, error)
BeginTransaction starts a new transaction
func (*BadgerStore) CompareAndSwap ¶
CompareAndSwap atomically updates a value if it matches the expected value
func (*BadgerStore) CompareAndSwapBatch ¶
func (s *BadgerStore) CompareAndSwapBatch(_ context.Context, mutations []CompareAndSwapMutation) error
CompareAndSwapBatch applies all conditional writes or none of them.
func (*BadgerStore) Delete ¶
func (s *BadgerStore) Delete(_ context.Context, key string) error
Delete removes a key
func (*BadgerStore) Ping ¶
func (s *BadgerStore) Ping(ctx context.Context) error
Ping checks if the store is healthy
func (*BadgerStore) Restore ¶
func (s *BadgerStore) Restore(_ context.Context, path string) error
Restore restores the database from a backup
func (*BadgerStore) ScanWithPrefix ¶
ScanWithPrefix returns keys with a specific prefix
func (*BadgerStore) SetWithTTL ¶
func (s *BadgerStore) SetWithTTL(_ context.Context, key string, value []byte, ttl time.Duration) error
SetWithTTL stores a key-value pair with a TTL Note: Badger v4 has per-second TTL granularity. TTLs less than 1 second may expire immediately.
type BadgerTransaction ¶
type BadgerTransaction struct {
// contains filtered or unexported fields
}
BadgerTransaction represents a Badger transaction
func (*BadgerTransaction) Commit ¶
func (t *BadgerTransaction) Commit(_ context.Context) error
Commit commits the transaction
func (*BadgerTransaction) CompareAndSwap ¶
func (t *BadgerTransaction) CompareAndSwap(key string, old, newValue []byte) error
CompareAndSwap atomically updates a value if it matches the expected value
func (*BadgerTransaction) Delete ¶
func (t *BadgerTransaction) Delete(key string) error
Delete removes a key within the transaction
func (*BadgerTransaction) Get ¶
func (t *BadgerTransaction) Get(key string) ([]byte, error)
Get retrieves a value within the transaction
func (*BadgerTransaction) Increment ¶
func (t *BadgerTransaction) Increment(key string, delta int64) (int64, error)
Increment atomically increments a counter within the transaction
func (*BadgerTransaction) Rollback ¶
func (t *BadgerTransaction) Rollback() error
Rollback aborts the transaction
func (*BadgerTransaction) Set ¶
func (t *BadgerTransaction) Set(key string, value []byte) error
Set stores a key-value pair within the transaction
func (*BadgerTransaction) SetWithTTL ¶
SetWithTTL stores a key-value pair with TTL within the transaction
type CompareAndSwapMutation ¶
type CompareAndSwapMutation struct {
Key string
ExpectedValue []byte
NewValue []byte
TTL time.Duration
}
CompareAndSwapMutation is one conditional write in an atomic mutation set. A nil ExpectedValue requires absence. A nil NewValue deletes the key. A positive TTL replaces the key expiration; zero preserves an existing TTL.
type Config ¶
type Config struct {
Type string `env:"TYPE,default=badger"`
Badger BadgerConfig `env:",prefix=BADGER_"`
Valkey ValkeyConfig `env:",prefix=VALKEY_"`
}
Config represents storage configuration
type KVStore ¶
type KVStore interface {
// Basic operations
Get(ctx context.Context, key string) ([]byte, error)
Set(ctx context.Context, key string, value []byte) error
Delete(ctx context.Context, key string) error
Exists(ctx context.Context, key string) (bool, error)
// TTL operations
SetWithTTL(ctx context.Context, key string, value []byte, ttl time.Duration) error
GetTTL(ctx context.Context, key string) (time.Duration, error)
ExpireAt(ctx context.Context, key string, expireAt time.Time) error
// Atomic operations
Increment(ctx context.Context, key string, delta int64) (int64, error)
Decrement(ctx context.Context, key string, delta int64) (int64, error)
CompareAndSwap(ctx context.Context, key string, old, newValue []byte) error
CompareAndSwapBatch(ctx context.Context, mutations []CompareAndSwapMutation) error
// Batch operations
BatchGet(ctx context.Context, keys []string) (map[string][]byte, error)
BatchSet(ctx context.Context, items map[string][]byte) error
BatchDelete(ctx context.Context, keys []string) error
BatchSetWithTTL(ctx context.Context, items map[string][]byte, ttl time.Duration) error
// Transaction support
BeginTransaction(ctx context.Context) (Transaction, error)
// Scan operations for listing keys
Scan(ctx context.Context, pattern string, limit int) ([]string, error)
ScanWithPrefix(ctx context.Context, prefix string, limit int) ([]string, error)
// Health check and lifecycle
Ping(ctx context.Context) error
Close() error
}
KVStore defines the interface for key-value storage operations. All implementations must be thread-safe and support concurrent access.
func Open ¶
Open creates a new KVStore instance based on the configuration. This follows the Go convention of using Open for creating connections.
func OpenReadOnly ¶ added in v1.0.1
OpenReadOnly opens configured storage without permitting a logical write.
func OpenValkey ¶
func OpenValkey(config ValkeyConfig) (KVStore, error)
OpenValkey creates a new Valkey-backed KVStore
type MockStore ¶
type MockStore struct {
// contains filtered or unexported fields
}
MockStore is an in-memory implementation of KVStore for testing
func NewMockStore ¶
func NewMockStore() *MockStore
NewMockStore creates a new mock KVStore for testing
func (*MockStore) BatchDelete ¶
BatchDelete removes multiple keys
func (*MockStore) BatchSetWithTTL ¶
func (m *MockStore) BatchSetWithTTL(ctx context.Context, items map[string][]byte, ttl time.Duration) error
BatchSetWithTTL stores multiple values with TTL
func (*MockStore) BeginTransaction ¶
func (m *MockStore) BeginTransaction(ctx context.Context) (Transaction, error)
BeginTransaction starts a new transaction
func (*MockStore) CompareAndSwap ¶
CompareAndSwap atomically updates a value if it matches the expected value
func (*MockStore) CompareAndSwapBatch ¶
func (m *MockStore) CompareAndSwapBatch(ctx context.Context, mutations []CompareAndSwapMutation) error
CompareAndSwapBatch applies all conditional writes or none of them.
func (*MockStore) ScanWithPrefix ¶
ScanWithPrefix returns keys with a specific prefix
type MockTransaction ¶
type MockTransaction struct {
// contains filtered or unexported fields
}
MockTransaction represents a mock transaction
func (*MockTransaction) Commit ¶
func (t *MockTransaction) Commit(_ context.Context) error
Commit applies all pending operations
func (*MockTransaction) CompareAndSwap ¶
func (t *MockTransaction) CompareAndSwap(key string, old, newValue []byte) error
CompareAndSwap performs CAS within the transaction
func (*MockTransaction) Delete ¶
func (t *MockTransaction) Delete(key string) error
Delete removes a key within the transaction
func (*MockTransaction) Get ¶
func (t *MockTransaction) Get(key string) ([]byte, error)
Get retrieves a value within the transaction
func (*MockTransaction) Increment ¶
func (t *MockTransaction) Increment(key string, delta int64) (int64, error)
Increment atomically increments within the transaction
func (*MockTransaction) Rollback ¶
func (t *MockTransaction) Rollback() error
Rollback discards all pending operations
func (*MockTransaction) Set ¶
func (t *MockTransaction) Set(key string, value []byte) error
Set stores a value within the transaction
func (*MockTransaction) SetWithTTL ¶
SetWithTTL stores a value with TTL within the transaction
type PubSubClient ¶
type PubSubClient interface {
// Subscribe to a pattern and handle messages
Subscribe(pattern string, handler func(channel, message string)) error
// Publish a message to a channel
Publish(ctx context.Context, channel string, message string) error
// Close the pub/sub client
Close() error
}
PubSubClient defines the interface for pub/sub operations used for cache invalidation
type PubSubProvider ¶
type PubSubProvider interface {
GetPubSub() PubSubClient
}
PubSubProvider is implemented by storage backends that support pub/sub
type Transaction ¶
type Transaction interface {
// Basic operations within transaction
Get(key string) ([]byte, error)
Set(key string, value []byte) error
Delete(key string) error
// TTL operations within transaction
SetWithTTL(key string, value []byte, ttl time.Duration) error
// Atomic operations within transaction
Increment(key string, delta int64) (int64, error)
CompareAndSwap(key string, old, newValue []byte) error
// Transaction control
Commit(ctx context.Context) error
Rollback() error
}
Transaction represents an atomic set of operations
type ValkeyConfig ¶
type ValkeyConfig struct {
URL string `env:"URL,default=redis://localhost:6379"`
MaxRetries int `env:"MAX_RETRIES,default=3"`
MinIdleConns int `env:"MIN_IDLE_CONNS,default=10"`
MaxConnAge time.Duration `env:"MAX_CONN_AGE,default=0"`
PoolTimeout time.Duration `env:"POOL_TIMEOUT,default=4s"`
ReadTimeout time.Duration `env:"READ_TIMEOUT,default=3s"`
WriteTimeout time.Duration `env:"WRITE_TIMEOUT,default=3s"`
Password string `env:"PASSWORD"`
DB int `env:"DB,default=0"`
ClusterMode bool `env:"CLUSTER_MODE,default=false"`
}
ValkeyConfig represents Valkey/Redis-specific configuration
type ValkeyPubSub ¶
type ValkeyPubSub struct {
// contains filtered or unexported fields
}
ValkeyPubSub implements PubSubClient using Valkey pub/sub
func NewValkeyPubSub ¶
func NewValkeyPubSub(client valkey.Client) *ValkeyPubSub
NewValkeyPubSub creates a new Valkey pub/sub client
type ValkeyStore ¶
type ValkeyStore struct {
// contains filtered or unexported fields
}
ValkeyStore implements KVStore interface using Valkey
func (*ValkeyStore) BatchDelete ¶
func (v *ValkeyStore) BatchDelete(ctx context.Context, keys []string) error
BatchDelete removes multiple keys
func (*ValkeyStore) BatchSetWithTTL ¶
func (v *ValkeyStore) BatchSetWithTTL(ctx context.Context, items map[string][]byte, ttl time.Duration) error
BatchSetWithTTL stores multiple key-value pairs with TTL
func (*ValkeyStore) BeginTransaction ¶
func (v *ValkeyStore) BeginTransaction(ctx context.Context) (Transaction, error)
BeginTransaction starts a new transaction
func (*ValkeyStore) CompareAndSwap ¶
CompareAndSwap atomically updates a value if it matches the old value
func (*ValkeyStore) CompareAndSwapBatch ¶
func (v *ValkeyStore) CompareAndSwapBatch(ctx context.Context, mutations []CompareAndSwapMutation) error
CompareAndSwapBatch applies all conditional writes or none of them.
func (*ValkeyStore) Delete ¶
func (v *ValkeyStore) Delete(ctx context.Context, key string) error
Delete removes a key
func (*ValkeyStore) GetPubSub ¶
func (v *ValkeyStore) GetPubSub() PubSubClient
GetPubSub returns the pub/sub client for cache invalidation
func (*ValkeyStore) Ping ¶
func (v *ValkeyStore) Ping(ctx context.Context) error
Ping checks if the connection is alive
func (*ValkeyStore) ScanWithPrefix ¶
func (v *ValkeyStore) ScanWithPrefix(ctx context.Context, prefix string, limit int) ([]string, error)
ScanWithPrefix returns keys with a specific prefix
func (*ValkeyStore) SetWithTTL ¶
func (v *ValkeyStore) SetWithTTL(ctx context.Context, key string, value []byte, ttl time.Duration) error
SetWithTTL stores a value with expiration
type ValkeyTransaction ¶
type ValkeyTransaction struct {
// contains filtered or unexported fields
}
ValkeyTransaction implements Transaction interface
func (*ValkeyTransaction) Commit ¶
func (t *ValkeyTransaction) Commit(ctx context.Context) error
Commit executes all commands in the transaction
func (*ValkeyTransaction) CompareAndSwap ¶
func (t *ValkeyTransaction) CompareAndSwap(key string, _, newValue []byte) error
CompareAndSwap within the transaction
func (*ValkeyTransaction) Delete ¶
func (t *ValkeyTransaction) Delete(key string) error
Delete removes a key within the transaction
func (*ValkeyTransaction) Get ¶
func (t *ValkeyTransaction) Get(key string) ([]byte, error)
Get retrieves a value within the transaction
func (*ValkeyTransaction) Increment ¶
func (t *ValkeyTransaction) Increment(key string, delta int64) (int64, error)
Increment atomically increments within the transaction
func (*ValkeyTransaction) Rollback ¶
func (t *ValkeyTransaction) Rollback() error
Rollback discards the transaction
func (*ValkeyTransaction) Set ¶
func (t *ValkeyTransaction) Set(key string, value []byte) error
Set stores a value within the transaction
func (*ValkeyTransaction) SetWithTTL ¶
SetWithTTL stores a value with TTL within the transaction