Skip to main content

Module concurrent_shards

Module concurrent_shards 

Source
Expand description

Sharded block cache: split keyspace into N independent shards by hash(key) % N. Each shard wraps the base BlockCache behind its own Mutex, so concurrent readers/writers on different shards don’t contend.

Per-shard contention counter (try_lock failures) is exposed via contention_events() for the metrics feature integration. The ShardedCache itself only tracks the counter when a put/get path actually backs off; it does NOT change correctness behaviour - if try_lock would have failed, we fall through to the blocking lock and still complete the op.

Structs§

ShardedCache