CachePolicy

data class CachePolicy(val percent: Double, val expiry: Duration)

Defines how cached responses are evaluated for freshness.

A CachePolicy supports two strategies:

  • A percentage-based window (percent) for detail-style endpoints.

  • A fixed time-based expiry (expiry) for list-style endpoints.

Throws

If percent is not between 0.0 and 1.0 (exclusive), or if expiry is less than 1 hour.

Constructors

Link copied to clipboard
constructor(percent: Double, expiry: Duration)

Properties

Link copied to clipboard

A minimum fixed duration after which responses are considered stale.

Link copied to clipboard

A value between 0.0 and 1.0 representing the fraction of the resource age used to compute the next revalidation window.