memory

package
v0.0.0-...-ae24e80 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: MPL-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 Backend

type Backend[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewBackend

func NewBackend[K comparable, V any]() *Backend[K, V]

NewBackend creates a new in-memory storage backend, which uses a slice to store entries.

func (*Backend[K, V]) Close

func (b *Backend[K, V]) Close(context.Context) error

Close is a no-op for the in-memory backend.

func (*Backend[K, V]) Delete

func (b *Backend[K, V]) Delete(ctx context.Context, key K) error

Delete removes a key-value pair from the in-memory store by its key.

func (*Backend[K, V]) Flush

func (b *Backend[K, V]) Flush(context.Context) error

Flush is a no-op for the in-memory backend.

func (*Backend[K, V]) Get

func (b *Backend[K, V]) Get(ctx context.Context, key K) (V, bool, error)

Get retrieves a value from the in-memory store by its key.

func (*Backend[K, V]) List

func (b *Backend[K, V]) List(ctx context.Context, pageSize *int, pageToken *K) (iter.Seq2[K, V], *K, error)

List retrieves all key-value pairs from the in-memory store, with optional pagination.

func (*Backend[K, V]) Set

func (b *Backend[K, V]) Set(ctx context.Context, key K, value V) error

Set stores a key-value pair in the in-memory store.

Jump to

Keyboard shortcuts

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