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.
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
- 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.
- Cache (Main Storage): The source of truth using an open-addressed index (Linear Probing).
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 LossyQueue.
4. 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
Single-Threaded Basic Usage
use ;
Multi-Threaded Concurrent Usage
use ;
use Arc;
use thread;
๐งช 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 custom criterion-based benchmarks for throughput, latency, and memory profiling.
By default, the benchmark suite only runs DualCacheFF:
To run a comparative benchmark against other caching libraries (like Moka and TinyUFO), enable the full_bench feature:
๐ License
This project is licensed under the MIT License.
Project co-developed and optimized with Antigravity.