Skip to main content

Module post_bundle_caching

Module post_bundle_caching 

Source
Expand description

§Post-bundle read cache

A moka weighted cache that holds recently-served post bundles in RAM so repeated reads for the same (location_id, originator) don’t thrash disk. Multiple versions per location_id are kept because different peer originators hold different slices of the same bucket — the cache index is keyed by (location_id, originator_id).

The cache doubles as a propagation hint engine: once a hot entry has been requested more than crate::server::post_bundle_caching_shared::CACHE_HIT_THRESHOLD times (10), the next requester’s response includes a signed [hashiverse_lib::protocol::payload::payload::CacheRequestTokenV1] asking them to forward the bundle to additional servers. This turns read pressure into better cache distribution without requiring explicit coordination.

An inflight sibling cache tracks outstanding tokens so the same hot bundle doesn’t generate redundant cache-request tokens in parallel.

Structs§

PostBundleCache
Intermediate-server cache for EncodedPostBundleV1 data.