buffer

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheBuffer

type CacheBuffer[T any] struct {
	// contains filtered or unexported fields
}

CacheBuffer acts as a staging area for cache operations. It fully implements internal.TypedTransaction[T].

func NewCacheBuffer

func NewCacheBuffer[T any](parent internal.TypedCache[T]) *CacheBuffer[T]

func (*CacheBuffer[T]) Clear

func (b *CacheBuffer[T]) Clear(ctx context.Context) error

func (*CacheBuffer[T]) Close

func (b *CacheBuffer[T]) Close(ctx context.Context) error

func (*CacheBuffer[T]) CounterValue

func (b *CacheBuffer[T]) CounterValue(ctx context.Context, key string) (int64, error)

func (*CacheBuffer[T]) Decrement

func (b *CacheBuffer[T]) Decrement(ctx context.Context, key string, amount int64) (int64, error)

func (*CacheBuffer[T]) Delete

func (b *CacheBuffer[T]) Delete(ctx context.Context, key string) error

func (*CacheBuffer[T]) Expire

func (b *CacheBuffer[T]) Expire(ctx context.Context, key string, ttl time.Duration) error

func (*CacheBuffer[T]) Flush

func (b *CacheBuffer[T]) Flush() (map[string]CacheBufferItem[T], bool)

Flush returns the tracked operations to be applied by the parent.

func (*CacheBuffer[T]) Get

func (b *CacheBuffer[T]) Get(ctx context.Context, key string) (T, error)

func (*CacheBuffer[T]) GetDefault

func (b *CacheBuffer[T]) GetDefault(ctx context.Context, key string, defaultValue T) (T, error)

func (*CacheBuffer[T]) Has

func (b *CacheBuffer[T]) Has(ctx context.Context, key string) bool

func (*CacheBuffer[T]) InTransaction

func (b *CacheBuffer[T]) InTransaction() bool

func (*CacheBuffer[T]) Increment

func (b *CacheBuffer[T]) Increment(ctx context.Context, key string, amount int64) (int64, error)

func (*CacheBuffer[T]) Keys

func (b *CacheBuffer[T]) Keys(ctx context.Context) ([]string, error)

func (*CacheBuffer[T]) Set

func (b *CacheBuffer[T]) Set(ctx context.Context, key string, value T, ttl time.Duration) error

func (*CacheBuffer[T]) TTL

func (b *CacheBuffer[T]) TTL(ctx context.Context, key string) time.Duration

type CacheBufferItem

type CacheBufferItem[T any] struct {
	Op       internal.CacheOperation // Tracks OP_SET, OP_DEL, etc.
	Value    T
	LifeTime time.Time
	TTL      time.Duration
}

CacheBufferItem tracks the state and operation of a single item in the buffer.

Jump to

Keyboard shortcuts

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