Module fastly::cache::core

source ·
Expand description

The Compute Core Cache API.

This API exposes the primitive operations required to implement high-performance cache applications with advanced features such as request collapsing, streaming miss, revalidation, and surrogate key purging.

While this API contains affordances for some HTTP caching concepts such as Vary headers and stale-while-revalidate, this API is not suitable for HTTP caching out-of-the-box. Future SDK releases will add a more customizable HTTP Cache API with support for customizable read-through caching, freshness lifetime inference, conditional request evaluation, automatic revalidation, and more.

Cached items in this API consist of:

  • A cache key: up to 4KiB of arbitrary bytes that identify a cached item. The cache key may not uniquely identify an item; headers can be used to augment the key when multiple items are associated with the same key. See LookupBuilder::header() for more details.

  • General metadata, such as expiry data (item age, when to expire, and surrogate keys for purging).

  • User-controlled metadata: arbitrary bytes stored alongside the cached item contents that can be updated when revalidating the cached item.

  • The object itself: arbitrary bytes read via Body and written via StreamingBody.

In the simplest cases, the top-level insert() and lookup() functions are used for one-off operations on a cached item, and are appropriate when request collapsing and revalidation capabilities are not required.

The API also supports more complex uses via Transaction, which can collapse concurrent lookups to the same item, including coordinating revalidation. See the Transaction documentation for more details.

Structs§

Enums§

Functions§

Type Aliases§

  • A cache key consists of up to 4KiB of arbitrary bytes.