Skip to main content

read_stored

Function read_stored 

Source
pub fn read_stored<C: CacheCodec>(
    bytes: &[u8],
    codec: &C,
) -> Result<Option<CacheRead>, CacheError>
Expand description

Reads a stored value, transparently accepting 0.5.x Redis entries.

Both decoders are attempted before a miss is reported, so the dispatch order is an optimisation and not a correctness requirement. Bytes that neither decoder recognises are reported as Ok(None) — a cache miss — rather than an error: the cache layer already treats a backend Err as a miss, an unreadable entry is semantically identical to an absent one, and a value that belongs to another application sharing the namespace must not take a request down. The miss is observable through a tracing::warn! and the tower_http_cache.decode_error counter. The value is never deleted.