filesystem
Module[Filesystem]: one file per key under a directory.
Contents
use utopia_cache::Filesystem;Rust
pub struct FilesystemOne file per key under a directory: the file's content is the value
(strings as they are, arrays as their items' strings joined) and its
modification time is the entry's timestamp. Keys containing / live in
subdirectories. Hashes are ignored.
Rust
use php_std::types::Value;
use utopia_cache::{Adapter, Filesystem};
let cache = Filesystem::new(&dir);
cache.save("notes/today", &Value::from("hello"), "", 0).await?;
assert_eq!(cache.load("notes/today", 60, "").await?, Some(Value::from("hello")));
assert_eq!(cache.size().await?, 5); // bytes