Skip to main content

maxAgeFromCacheControl

Reads the max-age of a Cache-Control header in seconds. no-store, no-cache, a missing header and anything unreadable give 0.

This is a function exported by @mapcairn/core, checked against version 0.2.0.

Signature​

import { maxAgeFromCacheControl } from "@mapcairn/core";

function maxAgeFromCacheControl(header: string | null): number;

Parameters​

  • header (string | null)

Returns​

number

Source: packages/core/src/layers/responseCache.ts:36