DualCache-FF (Fast and Furious)
A highly opinionated, absolutely wait-free concurrent cache in Rust, optimized for extreme read-to-write ratios and scan-resistance. Built for high-performance and
no_stdembedded compatibility.
DualcacheFF is a specialized, high-density concurrent primitive built on CQRS (Command Query Responsibility Segregation), QSBR (Quiet State Based Reclamation), and a novel Avg-based Clock Eviction Algorithm (Blackjack).
By deliberately abandoning heavy API contracts in favor of CPU spatial locality and wait-free semantics, DualcacheFF achieves massive throughput under hostile workloads.
Architecture Overview
1. Wait-Free Read Path & QSBR
All reads are completely non-blocking and wait-free. Memory reclamation is handled via Quiet State Based Reclamation (QSBR), allowing readers to instantly access cached nodes without locks, mutexes, or atomic reference counting overhead.
2. Three-Tier Promotion System
- T0 (L1 Cache): Ultra-fast array mapping for hyper-frequent hits.
- T1 (Hot Cache): A high-speed
AtomicPtrslot array mapping to Cache indices for instant lookup. - T2 (Secondary Filter): A larger slot array for capturing secondary heat patterns and delaying eviction.
- Cache (Arena): The source of truth using a flat Arena allocator.
3. Asynchronous Daemon & Batched Telemetry
Cache admissions and evictions are handled exclusively by an asynchronous background daemon. Read/write telemetry is buffered locally in Thread-Local Storage (TLS) and periodically flushed to the daemon via a custom lock-free mpsc_queue::BoundedQueue.
4. Blackjack (Avg-based Clock Eviction)
A revolution-shielded circular clock evicts items whose access rank falls below the global average, instantly adapting to shifting workload heat distributions.
Quick Start Examples
Basic Usage (DualCacheFF)
use DualCacheFF;
use DefaultExponentialPolicy;
Testing & Benchmarks
DualCache-FF comes with an extensive suite of integration tests, property tests, and benchmarks.
Running Tests
To run the full suite of unit and integration tests (including concurrency correctness and memory safety checks):
Running Benchmarks
DualCache-FF uses highly optimized custom benchmark harnesses (with harness = false) to accurately measure throughput, latency at the nanosecond scale, and memory profiling.
To run the full suite of benchmarks:
License
This project is licensed under the MIT License.