/* * Copyright (c) 2026, Tim Flynn * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include namespace HTTP { enum class CacheMode : u8 { // The cache is searched for a matching response. The cache is updated with the server's response. Default, // The cache is not searched for a matching response. The cache is not updated with the server's response. NoStore, // The cache is not searched for a matching response. The cache is updated with the server's response. Reload, // The cache is searched for a matching response, but must always revalidate. The cache is updated with the server's response. NoCache, // The cache is searched for a matching fresh or stale response. The cache is updated with the server's response. ForceCache, // The cache is searched for a matching fresh or stale response. A cache miss results in a network error. OnlyIfCached, }; constexpr bool cache_mode_permits_stale_responses(CacheMode cache_mode) { return cache_mode == CacheMode::ForceCache || cache_mode == CacheMode::OnlyIfCached; } }