v0.11.0
🎲 Random Replacement Policy!
Version 0.11.0 introduces the Random eviction policy for baseline benchmarking and simple use cases:
New Features:
- 🎲 Random Eviction Policy - Randomly evicts entries when cache is full
- ⚡ O(1) Performance - Constant-time eviction with no access tracking overhead
- 🔒 Thread-Safe RNG - Uses
fastrandfor fast, lock-free random selection - 📊 Minimal Overhead - No order updates on cache hits (unlike LRU/ARC)
- 🎯 Benchmark Baseline - Ideal for comparing policy effectiveness
- 🔄 All Cache Types - Available in sync (thread-local & global) and async caches
- 📚 Full Support - Works with
limit,ttl, andmax_memoryattributes
Quick Start:
// Simple random eviction - O(1) performance
#[cache(policy = "random", limit = 1000)]
fn baseline_cache(x: u64) -> u64 { x * x }
// Random with memory limit
#[cache(policy = "random", max_memory = "100MB")]
fn random_with_memory(key: String) -> Vec<u8> {
vec![0u8; 1024]
}When to Use Random:
- Baseline for performance benchmarks
- Truly random access patterns
- Simplicity preferred over optimization
- Reducing lock contention vs LRU/LFU
What's Changed
Full Changelog: 0.10.1...0.11.0