@substrate-system/cdn-cache-control
    Preparing search index...

    Class CacheHeaders

    Hierarchy

    • Headers
      • CacheHeaders
    Index

    Constructors

    Methods

    • Returns HeadersIterator<[string, string]>

    • Parameters

      • name: string
      • value: string

      Returns void

    • Copy the headers from this instance to another Headers instance.

      Type Parameters

      • T extends Headers

      Parameters

      • headers: T

      Returns T

    • Parameters

      • name: string

      Returns void

    • Returns an iterator allowing to go through all key/value pairs contained in this object.

      Returns HeadersIterator<[string, string]>

    • Parameters

      • callbackfn: (value: string, key: string, parent: Headers) => void
      • OptionalthisArg: any

      Returns void

    • Parameters

      • name: string

      Returns null | string

    • The parsed cache-control header for the browser cache.

      Returns Record<string, string>

    • The parsed content of the cache tags header.

      Returns string[]

    • The parsed cache-control header for the CDN cache.

      Returns Record<string, string>

    • Returns string[]

    • Parameters

      • name: string

      Returns boolean

    • Sets cache headers for content that should be cached for a long time and never revalidated. The CDN cache will cache the content for the specified time, and the browser will cache the content indefinitely without revalidating. Do not use this unless the URL is fingerprinted or otherwise unique. Otherwise, the browser will cache the content indefinitely and never check for updates, including for new deploys.

      Parameters

      • value: number = ONE_YEAR

        The number of seconds to set the CDN cache-control s-maxage directive to. Defaults to 1 year.

      Returns this

    • Returns an iterator allowing to go through all keys of the key/value pairs contained in this object.

      Returns HeadersIterator<string>

    • Parameters

      • name: string
      • value: string

      Returns void

    • Parameters

      • directives: Record<string, string>

      Returns void

    • Parameters

      • tags: string[]

      Returns void

    • Parameters

      • directives: Record<string, string>

      Returns void

    • Sets stale-while-revalidate directive for the CDN cache. By default the browser is sent a must-revalidate directive to ensure that the browser always revalidates the cache with the server.

      Parameters

      • value: number = ONE_WEEK

        The number of seconds to set the stale-while-revalidate directive to. Defaults to 1 week.

      Returns this

    • Adds a cache tag to the cache tags header. Cache tags are used to invalidate the cache for a URL.

      Parameters

      • tag: string | string[]

        The cache tag to add. Can be a string or an array of strings.

      • ...tags: string[]

      Returns this

    • Returns the headers as a plain object.

      Returns Record<string, string>

    • Sets the s-maxage for items in the CDN cache. This is the maximum amount of time that the CDN will cache the content. If used with swr, the content will revalidate in the background after the max age has passed. Otherwise, the content will be removed from the cache after the max age has passed.

      Parameters

      • value: number

      Returns this

    • Returns an iterator allowing to go through all values of the key/value pairs contained in this object.

      Returns HeadersIterator<string>