| Crates.io | fncache-macros |
| lib.rs | fncache-macros |
| version | 0.1.2 |
| created_at | 2025-08-17 19:05:13.148812+00 |
| updated_at | 2025-08-24 15:36:31.109128+00 |
| description | Procedural macros for the fncache crate |
| homepage | |
| repository | https://github.com/kumarlokesh/fncache |
| max_upload_size | |
| id | 1799646 |
| size | 10,895 |
Procedural macros for the fncache library, providing attribute macros for zero-boilerplate function caching.
This crate implements the procedural macros that power the fncache caching library. It's typically not used directly but through the main fncache crate.
This crate is meant to be used through the main fncache crate:
# Cargo.toml
[dependencies]
fncache = "0.1.0"
The macros are re-exported by the main crate:
use fncache::fncache;
#[fncache(ttl = 60)]
fn expensive_calculation(input: u64) -> u64 {
// This result will be cached for 60 seconds
input * input
}
#[fncache(ttl = 300, key_derivation = "compile_time")]
async fn fetch_data(id: &str) -> String {
// This uses compile-time key derivation and 300 second TTL
format!("Data for {}", id)
}
MIT License - see LICENSE for details.