betty.stores.no_op module

Key-value stores that do nothing.

final class betty.stores.no_op.NoOpStore

Bases: TransientStore[Any]

A key-value store that does nothing.

async clear() None

Clear all items from the store.

This operation s unsafe and MAY cause other concurrent operations on this store to fail.

async delete(key: str, /) None

Delete the item with the given key.

This operation s unsafe and MAY cause other concurrent operations on this store to fail.

async get(key: str, /) StoreItem[Any] | None

Get the item with the given key.

getset(key: str, /) AsyncIterator[StoreItemValueSetter[Any] | StoreItem[Any]]

Get the item with the given key, or provide a setter to add it within the same atomic operation.

async has(key: str, /) bool

Check if an item with the given key exists.

hasset(key: str, /) AsyncIterator[StoreItemValueSetter[Any] | None]

Check if an item with the given key exists, and if not, provide a setter to add or update it within the same atomic operation.

async set(key: str, value: Any, *, modified: float | None = None) None

Add or update an item.

with_scope(scope: str, /) Self

Return a new nested store with the given scope.