8 configuration options · available in Rust, Python
use opendal::Operator;
let op = Operator::via_iter("foyer", [
])?;
use opendal::Operator;
let op = Operator::via_iter("foyer", [
// Name for this cache instance.
// ("name".to_string(), "...".to_string()),
// Root path of this backend.
// ("root".to_string(), "...".to_string()),
// Memory capacity in bytes for the cache.
// ("memory".to_string(), "1000".to_string()),
// Disk cache directory path.
//
// If set, enables hybrid cache with disk storage. Data will be persisted to
// this directory when memory cache is full.
// ("disk_path".to_string(), "...".to_string()),
// Disk cache total capacity in bytes.
// Only used when `disk_path` is set.
// ("disk_capacity".to_string(), "1000".to_string()),
// Individual cache file size in bytes.
//
// Default is 1 MiB.
// Only used when `disk_path` is set.
// ("disk_file_size".to_string(), "1000".to_string()),
// Recovery mode when starting the cache.
//
// Valid values: "none" (default), "quiet", "strict".
// - "none": Don't recover from disk
// - "quiet": Recover and skip errors
// - "strict": Recover and panic on errors
// ("recover_mode".to_string(), "...".to_string()),
// Number of shards for concurrent access.
//
// Default is 1. Higher values improve concurrency but increase overhead.
// ("shards".to_string(), "1000".to_string()),
])?;
Every option is passed as a string key; OpenDAL parses it into the right type. Some services may require building the binding with the matching services-* feature enabled.
| Key | Type | Required | Description |
|---|---|---|---|
name | string | no | Name for this cache instance. |
root | string | no | Root path of this backend. |
memory | integer | no | Memory capacity in bytes for the cache. |
disk_path | string | no | Disk cache directory path. If set, enables hybrid cache with disk storage. Data will be persisted to this directory when memory cache is full. |
disk_capacity | integer | no | Disk cache total capacity in bytes.
Only used when disk_path is set. |
disk_file_size | integer | no | Individual cache file size in bytes.
Default is 1 MiB.
Only used when disk_path is set. |
recover_mode | string | no | Recovery mode when starting the cache. Valid values: "none" (default), "quiet", "strict". - "none": Don't recover from disk - "quiet": Recover and skip errors - "strict": Recover and panic on errors |
shards | integer | no | Number of shards for concurrent access. Default is 1. Higher values improve concurrency but increase overhead. |