Skip to main content

foyer

8 configuration options · available in Rust, Python

Quick start
use opendal::Operator;

let op = Operator::via_iter("foyer", [
])?;
All configuration options (copy & trim)
Full reference
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.

Configuration reference

General8
KeyTypeRequiredDescription
namestringnoName for this cache instance.
rootstringnoRoot path of this backend.
memoryintegernoMemory capacity in bytes for the cache.
disk_pathstringnoDisk cache directory path. If set, enables hybrid cache with disk storage. Data will be persisted to this directory when memory cache is full.
disk_capacityintegernoDisk cache total capacity in bytes. Only used when disk_path is set.
disk_file_sizeintegernoIndividual cache file size in bytes. Default is 1 MiB. Only used when disk_path is set.
recover_modestringnoRecovery 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
shardsintegernoNumber of shards for concurrent access. Default is 1. Higher values improve concurrency but increase overhead.