MemoryStorageClient
Hierarchy
- BaseStorageClient
- MemoryStorageClient
Index
Methods
__init__
A default constructor.
Parameters
optionalkeyword-onlywrite_metadata: bool
Whether to write metadata to the storage.
optionalkeyword-onlypersist_storage: bool
Whether to persist the storage.
optionalkeyword-onlystorage_dir: str
Path to the storage directory.
optionalkeyword-onlydefault_request_queue_id: str
The default request queue ID.
optionalkeyword-onlydefault_key_value_store_id: str
The default key-value store ID.
optionalkeyword-onlydefault_dataset_id: str
The default dataset ID.
Returns None
add_resource_client_to_cache
Add a new resource client to the internal cache.
Parameters
optionalkeyword-onlyresource_client: ResourceClient
Returns None
dataset
Gets a subclient for a specific dataset by its ID.
Parameters
optionalkeyword-onlyid: str
Returns BaseDatasetClient
datasets
Gets a subclient for dataset collection operations.
Returns BaseDatasetCollectionClient
from_config
Create a new instance based on the provided configuration.
All the memory storage client parameters are taken from the configuration object.
Parameters
optionalkeyword-onlyconfig: Configuration | None = None
The configuration object.
Returns MemoryStorageClient
get_cached_resource_client
Try to return a resource client from the internal cache.
Parameters
optionalkeyword-onlyresource_client_class: type[TResourceClient]
optionalkeyword-onlyid: str | None
optionalkeyword-onlyname: str | None
Returns TResourceClient | None
key_value_store
Gets a subclient for a specific key-value store by its ID.
Parameters
optionalkeyword-onlyid: str
Returns BaseKeyValueStoreClient
key_value_stores
Gets a subclient for key-value store collection operations.
Returns BaseKeyValueStoreCollectionClient
purge_on_start
Performs a purge of the default storages.
This method ensures that the purge is executed only once during the lifetime of the instance. It is primarily used to clean up residual data from previous runs to maintain a clean state. If the storage client does not support purging, leave it empty.
Returns None
request_queue
Gets a subclient for a specific request queue by its ID.
Parameters
optionalkeyword-onlyid: str
Returns BaseRequestQueueClient
request_queues
Gets a subclient for request queue collection operations.
Returns BaseRequestQueueCollectionClient
Properties
datasets_directory
Path to the directory containing datasets.
key_value_stores_directory
Path to the directory containing key-value stores.
persist_storage
Whether to persist the storage.
request_queues_directory
Path to the directory containing request queues.
storage_dir
Path to the storage directory.
write_metadata
Whether to write metadata to the storage.
Represents an in-memory storage client for managing datasets, key-value stores, and request queues.
It emulates in-memory storage similar to the Apify platform, supporting both in-memory and local file system-based persistence.
The behavior of the storage, such as data persistence and metadata writing, can be customized via initialization parameters or environment variables.