Skip to main content

Module http_cache

Module http_cache 

Source
Expand description

A memory cache implementing the logic specified in http://tools.ietf.org/html/rfc7234 and http://tools.ietf.org/html/rfc7232.

StructsΒ§

ApproxDuration πŸ”’
A duration in seconds.
CacheKey
The key used to differentiate requests in the cache.
CachedMetadata πŸ”’
Metadata about a loaded resource, such as is obtained from HTTP headers.
CachedResource
A complete cached resource.
CachedResponse πŸ”’
Wrapper around a cached response, including information on re-validation needs
HttpCache
A simple memory cache. Elements will be evicted based on the cache heuristic. We weight elements by the number of entries per given url. We evict currently a whole url. The cache makes extensive use of Arc::unwrap_or_clone or and Arc::into_inner to modify the cached entries. This is ok because CachedResource are cheap to clone
MemoryCacheLifecycle
The lifecycle hooks of the HttpCache. Responsible for moving data to the disk.
SerializeableHeaderMap πŸ”’
Wrapper type for HeaderMap

EnumsΒ§

CachedResourcesOrGuard
Returns an writeable entry into the cache or a guard for insertint an entry The guard will block other queries to the cache entry in both cases.
HttpCacheAssignment
Is this state assigned to the private or public side.
ValidationStatus
Whether a cached response is fresh or requires validation before or after use.

FunctionsΒ§

calculate_response_age πŸ”’
Calculating Age https://tools.ietf.org/html/rfc7234#section-4.2.3
construct_response πŸ”’
Constructing Responses from Caches. https://tools.ietf.org/html/rfc7234#section-4
create_cached_response πŸ”’
Create a CachedResponse from a request and a CachedResource.
create_resource_with_bytes_from_resource πŸ”’
Create a new resource, based on the bytes requested, and an existing resource, with a status-code of 206.
get_expiry_adjustment_from_request_headers πŸ”’
Request Cache-Control Directives https://tools.ietf.org/html/rfc7234#section-5.2.1
get_response_expiry πŸ”’
Determine the expiry date from relevant headers, or uses a heuristic if none are present.
get_stale_while_revalidate πŸ”’
The headers crate’s CacheControl does not understand stale-while-revalidate directive, so we need to parse the raw Cache-Control header values. https://datatracker.ietf.org/doc/html/rfc5861#section-3
handle_range_request πŸ”’
Support for range requests https://tools.ietf.org/html/rfc7233.
invalidate_cached_resources πŸ”’
is_cacheable_by_default πŸ”’
Determine if a response is cacheable by default https://tools.ietf.org/html/rfc7231#section-6.1
refresh
Freshening Stored Responses upon Validation. https://tools.ietf.org/html/rfc7234#section-4.3.4
request_demands_revalidation πŸ”’
Determine whether the request itself demands revalidation. https://www.rfc-editor.org/rfc/rfc9111.html#section-5.2.1
resolve_location_url πŸ”’
response_is_cacheable πŸ”’
Determine if a given response is cacheable. Based on https://tools.ietf.org/html/rfc7234#section-3

Type AliasesΒ§

CacheEntry πŸ”’
QuickCache πŸ”’
QuickCachePlaceholderGuard πŸ”’