dualcache_ff/lib.rs
1//! # DualCache-FF (Fast and Furious)
2//!
3//! A highly opinionated, absolutely wait-free concurrent cache in Rust, optimized for extreme
4//! read-to-write ratios and scan-resistance. Built for high-performance and `no_std` embedded
5//! target environments.
6//!
7//! ## 🧠Key Concepts & Features
8//!
9//! - **Wait-Free Read Path & QSBR**: All reads are completely non-blocking and wait-free.
10//! Memory reclamation is handled via Quiet State Based Reclamation (QSBR), allowing readers
11//! to instantly access cached nodes without locks, mutexes, or atomic reference counting overhead.
12//! - **Three-Tier Promotion System**:
13//! - **T1 (Hot Cache)**: A high-speed `AtomicPtr` slot array mapping to Cache indices for instant lookup.
14//! - **T2 (Secondary Filter)**: A larger slot array for capturing secondary heat patterns.
15//! - **Cache (Main Storage)**: The source of truth using an open-addressed index (Linear Probing).
16//! - **Asynchronous Daemon & Batched Telemetry**: Cache admissions and evictions are handled
17//! exclusively by an asynchronous background daemon. Read/write telemetry is buffered locally
18//! in Thread-Local Storage (TLS) and periodically flushed to the daemon via a custom lock-free `LossyQueue`.
19//! - **Avg-based Clock Eviction**: A revolution-shielded circular clock evicts items whose
20//! access rank falls below the global average, instantly adapting to shifting workload heat distributions.
21//! - **`no_std` / Bare-Metal Fallback**: Out-of-the-box support for resource-constrained environments
22//! via `StaticDualCache`, using atomic spinlocks to eliminate background threads and achieve zero idle power.
23
24#![cfg_attr(all(not(feature = "std"), not(any(feature = "loom", loom))), no_std)]
25extern crate alloc;
26
27#[doc(hidden)]
28pub mod arena;
29#[doc(hidden)]
30pub mod components;
31#[doc(hidden)]
32pub mod config;
33#[doc(hidden)]
34pub mod cache;
35#[doc(hidden)]
36pub mod daemon;
37#[doc(hidden)]
38pub mod filters;
39#[doc(hidden)]
40pub mod lossy_queue;
41#[doc(hidden)]
42pub mod storage;
43#[doc(hidden)]
44pub mod unsafe_core;
45#[doc(hidden)]
46pub mod workers;
47#[doc(hidden)]
48pub mod static_cache;
49#[doc(hidden)]
50pub mod core_cache;
51pub(crate) mod sync;
52
53pub use config::Config;
54pub use cache::{DualCacheFF, WorkerState};
55pub use components::{DefaultSpawner, DefaultTls, CachePadded};
56pub use daemon::Daemon;
57pub use static_cache::static_cache::StaticDualCache;