bhandaar 0.1.0-alpha.1

On-disk LRU/TTL file cache for Rust with cross-process concurrency via flock(2)
Documentation
//! # 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());
//! }
//! ```

mod cache;
mod error;
mod eviction;
mod hasher;
mod metadata;
mod shard;
mod store;

pub use cache::Bhandaar;
pub use error::BhandaarError;
pub use metadata::EntryMeta;

/// Configuration for creating a Bhandaar cache instance.
#[derive(Debug, Clone)]
pub struct BhandaarConfig {
    /// Root directory for cached files.
    pub root: std::path::PathBuf,
    /// Maximum total size in bytes (required, no default).
    pub max_size: u64,
    /// Number of shards for concurrent access (user-defined).
    pub shards: usize,
    /// Global default TTL for entries (optional).
    pub default_ttl: Option<std::time::Duration>,
}