Skip to main content

Cacache

Cacache services support.

Capabilities

This service can be used to:

  • stat
  • read
  • write
  • create_dir
  • delete
  • copy
  • rename
  • list
  • scan
  • presign
  • blocking

Configuration

  • datadir: Set the path to the cacache data directory

You can refer to [CacacheBuilder]'s docs for more information

Example

Via Builder

use anyhow::Result;
use opendal::services::Cacache;
use opendal::Operator;

#[tokio::main]
async fn main() -> Result<()> {
let mut builder = Cacache::default();
builder.datadir("/tmp/opendal/cacache");

let op: Operator = Operator::new(builder)?.finish();
Ok(())
}

Via Config

use anyhow::Result;
use opendal::services::Cacache;
use opendal::Operator;

#[tokio::main]
async fn main() -> Result<()> {

let mut map = HashMap::new();
map.insert("datadir".to_string(), "/tmp/opendal/cacache".to_string());

let op: Operator = Operator::via_map(Scheme::Cacache, map)?;
Ok(())
}