OxL Reference

data CacheRule

Cache-Control for the paths that match pattern: a glob with at most one * (assets/*, *.html, *).

Example:

oxl✓ checked in CI
use std.web { CacheRule, cacheRule }

fn main() io {
  let r: CacheRule = cacheRule("assets/*", "public, max-age=31536000, immutable")
  print("{r.pattern} -> {r.control}")
}
Output
assets/* -> public, max-age=31536000, immutable
@derive(Clone)
pub(api) data CacheRule

Thread safety. an immutable value; safe to share.

Since. 1.0.0-beta

Fields

pub(api) pattern: str

A glob with at most one * (assets/*, *.html).

pub(api) control: str

The Cache-Control value to send.

Defined in: std/web/web.oxl:69

See also