Skip to main content

Module cache_eip

Module cache_eip 

Source
Expand description

Cache EIP — outcome-aware Segment implementation.

Implements the Caching pattern (lookup → on-miss sub-pipeline → write-back) at the OutcomePipeline layer (one layer above Tower), mirroring [IdempotentConsumerSegment]. On a cache HIT the body is reconstructed from the stored CacheEntry and the on-miss sub-pipeline is skipped entirely; on a MISS the sub-pipeline runs and its result body is written back into the repository (subject to max_entry_bytes).

§Why Segment-mode (NOT Process-mode)

Same rationale as the idempotent consumer: a Tower Service<Exchange> cannot propagate PipelineOutcome::Stopped distinctly from Ok(ex). By implementing OutcomePipeline directly, a Stopped from the on-miss sub-pipeline flows out with the Exchange intact and NO write-back occurs (ADR-0024, ADR-0025).

§Contract C1 (ADR-0023)

CacheRepository::get / CacheRepository::set surface backend failures as Err(CamelError). The segment propagates those as PipelineOutcome::Failed — it NEVER treats a failed read as a miss.

Structs§

CacheInvalidateService
Outcome-aware segment that invalidates a single cache entry.
CachePeekStaleService
Outcome-aware segment that serves a stale (post-expiry) cache entry.
CacheService
Outcome-aware Cache segment (Caching EIP).