Struct ImageCachePreference
sealed struct ImageCachePreference
Types of caching strategy for image load requests.
Each value controls whether the cache is consulted, whether TTL expiration
(configured via IImageCacheManager::setDefaultExpiration) is respected,
and whether a network fetch is attempted on cache miss.
Fields
Constants
DEFAULT
Cache-first with TTL. TheImageCachePreference={0}
IImageLoadRequest is fulfilled from cache if a
fresh (non-expired) entry exists. Expired entries are discarded and data is loaded
from the originating source. On cache miss, data is loaded from the originating source.
TTL is determined by IImageCacheManager::setDefaultExpiration. HTTP response
cache headers are NOT consulted; see ImageCachePreference::WEB for HTTP-header-based caching.
RELOAD
Network-only. Existing cache data is bypassed entirely — the cache is neither read nor consulted for freshness. Data is always loaded from the originating source.ImageCachePreference={1}
ONLY_CACHE
Cache-only with TTL. A fresh (non-expired) cached entry is used to fulfill theImageCachePreference={2}
IImageLoadRequest. Expired entries are discarded. On cache miss or expiration,
no network fetch is attempted and the load is considered failed.
TTL is determined by IImageCacheManager::setDefaultExpiration.
WEB
HTTP-standard caching. TheImageCachePreference={3}
IImageLoadRequest follows standard HTTP caching
procedures: HTTP response cache headers from the originating source determine caching
duration. A cached entry is used if fresh per those headers. If the cached entry has
expired or there is a cache miss, data is loaded from the originating source.
Unlike ImageCachePreference::DEFAULT, expiration is governed by HTTP headers rather than
IImageCacheManager::setDefaultExpiration.
DEFAULT_NO_TTL
LikeImageCachePreference={4}
ImageCachePreference::DEFAULT, but TTL is ignored. Any cached entry — fresh or expired — is
returned immediately without checking expiration. On cache miss, data is loaded from
the originating source.
ONLY_CACHE_NO_TTL
LikeImageCachePreference={5}
ImageCachePreference::ONLY_CACHE, but TTL is ignored. Any cached entry — fresh or expired —
is returned immediately without checking expiration. On cache miss, no network fetch
is attempted and the load is considered failed.
