Skip to main content

Module post_bundle_caching_shared

Module post_bundle_caching_shared 

Source
Expand description

§Shared types and tuning constants for the bundle caches

The common pieces used by both crate::server::post_bundle_caching and crate::server::post_bundle_feedback_caching:

  • CachedBundle — bytes + optional expires_at. Live (still-mutating) bundles carry an expiry; sealed (immutable past-tense) bundles do not and stay cached until evicted by LRU pressure.
  • GetCacheResult — lookup outcome: Miss, Hit, HitAndIssueToken (the latter triggering [hashiverse_lib::protocol::payload::payload::CacheRequestTokenV1] emission from the caller).
  • CACHE_LOCATION_TTI (60 s) and CACHE_HIT_THRESHOLD (10) — the tuning that decides when a bundle is “hot enough” to justify asking callers to help replicate it further.

Structs§

CachedBundle
One bundle (from one originator peer) held in the cache.
GetCacheResult
Result returned to the dispatch handler by either cache’s on_get.

Constants§

CACHE_HIT_THRESHOLD
Number of hits on a placeholder entry before the server issues a CacheRequestToken. Essentially: have we had this many requests in the last CACHE_LOCATION_TTI? If so, start caching.
CACHE_LOCATION_TTI
TTI for all cache entries: if a location_id hasn’t been queried for a while, evict it entirely.
CACHE_REQUEST_TOKEN_TTL_DURATION
CACHE_REQUEST_TOKEN_TTL_DURATION_MILLIS
How long a CacheRequestToken is valid for (client must upload within this window).