Options for controlling caching behavior at edge

Hierarchy

  • EdgeCacheOptions

Properties

forcePrivateCaching?: boolean

Allows you to force caching of responses marked as private in their cache-control header. This option must be used with utmost care to avoid leaking private information.

Example

 import { Router, CustomCacheKey } from '@edgio/core/router'

new Router()
.match('/private/path', ({ cache }) => {
cache({
edge: {
maxAgeSeconds: 60 * 60,
key: new CustomCacheKey()
.addCookie('session'),
forcePrivateCaching: true,
}
})
})
maxAgeSeconds?: string | number

The maximum number of seconds (or Saifish time interval) that a response is served from the cache until it is considered stale. Unless staleWhileRevalidate is specified, stale responses will not be returned to the browser.

staleWhileRevalidateSeconds?: string | number

Extends the duration that a response will be served from the cache after it has become stale. When using staleWhileRevalidate, if Edgio receives a request for a stale asset, the cached response will be served and a fresh response will be concurrently fetch so that it can be served for future requests. The stale response will continue to be served until the fresh fetched.

Generated using TypeDoc