Documentation
¶
Index ¶
- type CacheBuffer
- func (b *CacheBuffer[T]) Clear(ctx context.Context) error
- func (b *CacheBuffer[T]) Close(ctx context.Context) error
- func (b *CacheBuffer[T]) CounterValue(ctx context.Context, key string) (int64, error)
- func (b *CacheBuffer[T]) Decrement(ctx context.Context, key string, amount int64) (int64, error)
- func (b *CacheBuffer[T]) Delete(ctx context.Context, key string) error
- func (b *CacheBuffer[T]) Expire(ctx context.Context, key string, ttl time.Duration) error
- func (b *CacheBuffer[T]) Flush() (map[string]CacheBufferItem[T], bool)
- func (b *CacheBuffer[T]) Get(ctx context.Context, key string) (T, error)
- func (b *CacheBuffer[T]) GetDefault(ctx context.Context, key string, defaultValue T) (T, error)
- func (b *CacheBuffer[T]) Has(ctx context.Context, key string) bool
- func (b *CacheBuffer[T]) InTransaction() bool
- func (b *CacheBuffer[T]) Increment(ctx context.Context, key string, amount int64) (int64, error)
- func (b *CacheBuffer[T]) Keys(ctx context.Context) ([]string, error)
- func (b *CacheBuffer[T]) Set(ctx context.Context, key string, value T, ttl time.Duration) error
- func (b *CacheBuffer[T]) TTL(ctx context.Context, key string) time.Duration
- type CacheBufferItem
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]) CounterValue ¶
func (*CacheBuffer[T]) Delete ¶
func (b *CacheBuffer[T]) Delete(ctx context.Context, key string) 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]) InTransaction ¶
func (b *CacheBuffer[T]) InTransaction() bool
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.
Click to show internal directories.
Click to hide internal directories.