MemoryKeyValueStoreClient
Hierarchy
- KeyValueStoreClient
- MemoryKeyValueStoreClient
Index
Methods
__init__
Initialize a new instance.
Preferably use the
MemoryKeyValueStoreClient.open
class method to create a new instance.Parameters
keyword-onlymetadata: KeyValueStoreMetadata
Returns None
delete_value
Delete a value from the key-value store by its key.
The backend method for the
KeyValueStore.delete_value
call.Parameters
keyword-onlykey: str
Returns None
drop
Drop the whole key-value store and remove all its values.
The backend method for the
KeyValueStore.drop
call.Returns None
get_metadata
Get the metadata of the key-value store.
Returns KeyValueStoreMetadata
get_public_url
Get the public URL for the given key.
The backend method for the
KeyValueStore.get_public_url
call.Parameters
keyword-onlykey: str
Returns str
get_value
Retrieve the given record from the key-value store.
The backend method for the
KeyValueStore.get_value
call.Parameters
keyword-onlykey: str
Returns KeyValueStoreRecord | None
iterate_keys
Iterate over all the existing keys in the key-value store.
The backend method for the
KeyValueStore.iterate_keys
call.Parameters
optionalkeyword-onlyexclusive_start_key: str | None = None
optionalkeyword-onlylimit: int | None = None
Returns AsyncIterator[KeyValueStoreRecordMetadata]
open
Open or create a new memory key-value store client.
This method creates a new in-memory key-value store instance. Unlike persistent storage implementations, memory KVS don't check for existing stores with the same name or ID since all data exists only in memory and is lost when the process terminates.
Parameters
keyword-onlyid: str | None
The ID of the key-value store. If not provided, a random ID will be generated.
keyword-onlyname: str | None
The name of the key-value store. If not provided, the store will be unnamed.
Returns MemoryKeyValueStoreClient
purge
Purge all items from the key-value store.
The backend method for the
KeyValueStore.purge
call.Returns None
record_exists
Check if a record with the given key exists in the key-value store.
The backend method for the
KeyValueStore.record_exists
call.Parameters
keyword-onlykey: str
The key to check for existence.
Returns bool
set_value
Set a value in the key-value store by its key.
The backend method for the
KeyValueStore.set_value
call.Parameters
keyword-onlykey: str
keyword-onlyvalue: Any
optionalkeyword-onlycontent_type: str | None = None
Returns None
Memory implementation of the key-value store client.
This client stores data in memory as Python dictionaries. No data is persisted between process runs, meaning all stored data is lost when the program terminates. This implementation is primarily useful for testing, development, and short-lived crawler operations where persistence is not required.
The memory implementation provides fast access to data but is limited by available memory and does not support data sharing across different processes.