MCPcopy Create free account
hub / github.com/CesiumGS/cesium-native / shouldRevalidateCache

Function shouldRevalidateCache

CesiumAsync/src/CachingAssetAccessor.cpp:344–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342namespace {
343
344bool shouldRevalidateCache(const CacheItem& cacheItem) {
345 std::optional<ResponseCacheControl> cacheControl =
346 ResponseCacheControl::parseFromResponseHeaders(
347 cacheItem.cacheResponse.headers);
348 if (cacheControl && cacheControl->noCache())
349 return true;
350
351 // Always revalidate if cache is stale. We always assume online scenarios.
352 // A must-revalidate directive doesn't change this logic.
353 return isCacheStale(cacheItem);
354}
355
356bool isCacheStale(const CacheItem& cacheItem) noexcept {
357 const std::time_t currentTime = std::time(nullptr);

Callers 1

getMethod · 0.85

Calls 2

isCacheStaleFunction · 0.85
noCacheMethod · 0.80

Tested by

no test coverage detected