Skip to main content

KeyValueStoreClient

crawlee.memory_storage_client.key_value_store_client.KeyValueStoreClient

Subclient for manipulating a single key-value store.

Index

Constructors

__init__

  • __init__(*, memory_storage_client, id, name, created_at, accessed_at, modified_at): None
  • Parameters

    • memory_storage_client: MemoryStorageClientkeyword-only
    • id: str | None = Nonekeyword-only
    • name: str | None = Nonekeyword-only
    • created_at: datetime | None = Nonekeyword-only
    • accessed_at: datetime | None = Nonekeyword-only
    • modified_at: datetime | None = Nonekeyword-only

    Returns None

Methods

delete

  • async delete(): None
  • Returns None

delete_persisted_record

  • async delete_persisted_record(record): None
  • Delete the specified record from the key-value store.


    Parameters

    • record: KeyValueStoreRecord

    Returns None

delete_record

  • async delete_record(key): None
  • Parameters

    • key: str

    Returns None

get

  • async get(): KeyValueStoreMetadata | None
  • Returns KeyValueStoreMetadata | None

get_record

  • async get_record(key): KeyValueStoreRecord | None
  • Parameters

    • key: str

    Returns KeyValueStoreRecord | None

get_record_as_bytes

  • async get_record_as_bytes(key): KeyValueStoreRecord[bytes] | None
  • Parameters

    • key: str

    Returns KeyValueStoreRecord[bytes] | None

list_keys

  • async list_keys(*, limit, exclusive_start_key): KeyValueStoreListKeysPage
  • Parameters

    • limit: int = 1000keyword-only
    • exclusive_start_key: str | None = Nonekeyword-only

    Returns KeyValueStoreListKeysPage

persist_record

  • async persist_record(record): None
  • Persist the specified record to the key-value store.


    Parameters

    • record: KeyValueStoreRecord

    Returns None

set_record

  • async set_record(key, value, content_type): None
  • Parameters

    • key: str
    • value: Any
    • content_type: str | None = None

    Returns None

stream_record

  • async stream_record(key): AsyncContextManager[KeyValueStoreRecord[Response] | None]
  • Parameters

    • key: str

    Returns AsyncContextManager[KeyValueStoreRecord[Response] | None]

update

  • async update(*, name): KeyValueStoreMetadata
  • Parameters

    • name: str | None = Nonekeyword-only

    Returns KeyValueStoreMetadata

update_timestamps

  • async update_timestamps(*, has_been_modified): None
  • Update the timestamps of the key-value store.


    Parameters

    • has_been_modified: boolkeyword-only

    Returns None

Properties

resource_directory

resource_directory: str

Get the resource directory for the client.

resource_info

resource_info: KeyValueStoreMetadata

Get the resource info for the key-value store client.