file¶
- class litestar.stores.file.FileStore[原始碼]¶
基底類別:
NamespacedStoreFile based, thread and process safe, asynchronous key/value store.
備註
To ensure arbitrary keys can safely be stored on any file system without potentially causing issues due to path separators or collisions, they are hashed with BLAKE2 before being interpreted as a file path. This means that the cache key becomes opaque inside the store, and a key does not translate to a file with that name on the file system.
- path¶
file path
- create_directories¶
flag to create directories in path
- with_namespace(namespace: str) FileStore[原始碼]¶
Return a new instance of
FileStore, using a sub-path of the current store's path.
- async set(key: str, value: str | bytes, expires_in: int | timedelta | None = None) None[原始碼]¶
Set a value.
- async delete(key: str) None[原始碼]¶
Delete a value.
If no such key exists, this is a no-op.
- 參數:
key¶ -- Key of the value to delete
- async delete_all() None[原始碼]¶
Delete all stored values.
備註
This deletes and recreates
FileStore.path