Record

write-options

Configuration for several functions that write to the cache:

  • insert
  • transaction-insert
  • transaction-insert-and-stream-back
  • transaction-update

Some options are only allowed for certain of these hostcalls; see the comments on the fields.

record write-options {
  max-age-ns: duration-ns,
  request-headers: option​<borrow​<request>>,
  vary-rule: option​<string>,
  initial-age-ns: option​<duration-ns>,
  stale-while-revalidate-ns: option​<duration-ns>,
  surrogate-keys: option​<string>,
  length: option​<object-length>,
  user-metadata: option​<list​<u8>>,
  edge-max-age-ns: option​<duration-ns>,
  sensitive-data: bool,
  extra: option​<borrow​<extra-write-options>>,
}

Fields

NameTypeDescription
max-age-nsduration-ns

this is a required field

request-headersoption​<borrow​<request>>

a full request handle, but used only for its headers

Only allowed for non-transactional insert; in a transaction, the request headers are passed at lookup time, and cannot be changed later.

vary-ruleoption​<string>

a list of header names separated by spaces

initial-age-nsoption​<duration-ns>

The initial age of the object in nanoseconds (default: 0).

This age is used to determine the freshness lifetime of the object as well as to prioritize which variant to return if a subsequent lookup matches more than one vary rule

stale-while-revalidate-nsoption​<duration-ns>
surrogate-keysoption​<string>

a list of surrogate keys separated by spaces

lengthoption​<object-length>
user-metadataoption​<list​<u8>>
edge-max-age-nsoption​<duration-ns>
sensitive-databool
extraoption​<borrow​<extra-write-options>>

Additional options may be added in the future via this resource type.