Skip to main content

Module content_aware_cache

Module content_aware_cache 

Source
Expand description

Media-content-aware caching.

Standard eviction policies treat all entries equally. For multimedia workloads, different content types have very different access patterns and cost/benefit trade-offs:

  • Manifests are tiny but highly re-fetched → very high priority, short TTL.
  • Video segments are large and often sequential → medium priority, long TTL.
  • Thumbnails are small and rarely re-fetched but cheap → very long TTL.

ContentAwareCache layers this domain knowledge on top of LruCache so that eviction candidates are scored by a combined recency × priority × size-efficiency metric rather than pure LRU order.

Structs§

CacheEntry
A single entry held in ContentAwareCache.
ContentAwareCache
A media-content-aware cache that scores eviction candidates by a recency × priority × size metric rather than pure LRU order.
ContentCachePriority
Numeric priority (higher = more important to keep in cache).

Enums§

MediaContentType
The media type of a cached entry.

Functions§

ttl_for_type
Return the recommended TTL for the given content type.