1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! # bhandaar (भंडार)
//!
//! On-disk LRU/TTL file cache for Rust with cross-process concurrency via `flock(2)`.
//!
//! **bhandaar** (भंडार) — Hindi for "storehouse, repository"
//!
//! ## Features
//!
//! - **LRU eviction** — least recently used entries are evicted first
//! - **TTL support** — per-entry time-to-live with lazy expiration
//! - **Cross-process safe** — uses `filock` for `flock(2)` locking
//! - **Sharded design** — user-defined shard count for concurrent access
//! - **Greedy storage** — fills up to max size, evicts only when needed
//! - **Sidecar metadata** — bincode-serialized, no central bottleneck
//!
//! ## Quick Start
//!
//! ```no_run
//! use bhandaar::{Bhandaar, BhandaarConfig};
//!
//! let cache = Bhandaar::new(BhandaarConfig {
//! root: "/tmp/bhandaar".into(),
//! max_size: 1024 * 1024 * 1024, // 1 GB
//! shards: 16,
//! default_ttl: None,
//! }).unwrap();
//!
//! // Put data
//! cache.put("key1", b"hello world").unwrap();
//!
//! // Get data
//! if let Some(data) = cache.get("key1").unwrap() {
//! println!("Got {} bytes", data.len());
//! }
//! ```
pub use Bhandaar;
pub use BhandaarError;
pub use EntryMeta;
/// Configuration for creating a Bhandaar cache instance.