fcache

Crates.iofcache
lib.rsfcache
version0.0.1
created_at2025-08-24 22:07:09.277412+00
updated_at2025-08-29 15:56:34.990083+00
descriptionFile caching library with lazy creation, automatic refresh, and callback-based initialization
homepage
repositoryhttps://github.com/ventaquil/fcache
max_upload_size
id1808832
size1,171,058
kgolawski (ventaquil)

documentation

README

fcache

GitHub Build docs.rs MSRV unsafe forbidden LICENSE

A Rust library for efficient file caching with a straightforward interface for creating, retrieving, and managing cached files efficiently.

Setup

Add this to your Cargo.toml:

[dependencies]
fcache = "0.0.1"

Alternatively, you can use the cargo add subcommand:

cargo add fcache

Usage

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.

License

This crate is licensed under the MIT License.

Commit count: 8

cargo fmt