Skip to main content

recommended_cache_shards

Function recommended_cache_shards 

Source
pub fn recommended_cache_shards(capacity: usize) -> usize
Expand description

Recommended shard count: min(cpus / 2, capacity / 4 GiB), power of two in [1, 1024]. The cpu term bounds lock contention; the capacity term keeps each shard’s budget >= 4 GiB so large entries stay admissible. Rounded down because quick_cache rounds requests up.