Crates.io | fcache |
lib.rs | fcache |
version | 0.0.1 |
created_at | 2025-08-24 22:07:09.277412+00 |
updated_at | 2025-08-29 15:56:34.990083+00 |
description | File caching library with lazy creation, automatic refresh, and callback-based initialization |
homepage | |
repository | https://github.com/ventaquil/fcache |
max_upload_size | |
id | 1808832 |
size | 1,171,058 |
A Rust library for efficient file caching with a straightforward interface for creating, retrieving, and managing cached files efficiently.
Add this to your Cargo.toml
:
[dependencies]
fcache = "0.0.1"
Alternatively, you can use the cargo add
subcommand:
cargo add fcache
Use the library functions to create cache instances and manage files:
use fcache::prelude::*;
fn main() -> fcache::Result<()> {
// Create a new cache instance
let cache = fcache::new()?;
// Create a file with callback
let cache_file = cache.get("data.txt", |mut file| {
file.write_all(b"Hello, World!")?;
Ok(())
})?;
// Read from the file
let mut content = String::new();
cache_file.open()?.read_to_string(&mut content)?;
println!("Content: {}", content);
Ok(())
}
For more usage examples, refer to the documentation available at docs.rs.
This crate is licensed under the MIT License.