Skip to main content

Caching Policy

Respond to matched incoming requests with cached content

Configuration

{
"name": "my-caching-inbound-policy",
"policyType": "caching-inbound",
"handler": {
"export": "CachingInboundPolicy",
"module": "$import(@zuplo/runtime)",
"options": {
"expirationSecondsTtl": 60,
"dangerouslyIgnoreAuthorizationHeader": false,
"headers": [
"header_used_as_part_of_cache_key"
]
}
}
}
  • name the name of your policy instance. This is used as a reference in your routes.
  • policyType the identifier of the policy. This is used by the Zuplo UI. Value should be caching-inbound.
  • handler/export The name of the exported type. Value should be CachingInboundPolicy.
  • handler/module the module containing the policy. Value should be $import(@zuplo/runtime).
  • handler/options The options for this policy:
    • dangerouslyIgnoreAuthorizationHeader

      By default, the Authorization header is always considered in the caching policy. You can disable by setting this to true

    • headers

      The headers to be considered when caching

    • expirationSecondsTtl

      The timeout of the cache in seconds

    • statusCodes

      Response status codes to be cached - defaults to 200, 206, 301, 302, 303, 404, 410 if none specified

Read more about how policies work