Skip to content
Playground(another site)

bynk.http.cache_bad_immutable

Error A @cache annotation's immutable is not a Bool literal.

immutable on @cache promises that the response at this URL never changes, so a cache may reuse it for the whole maxAge without asking again. A promise is either made or not, so the value must be the literal true or false; a bare word, a string or an expression is refused. Write immutable: true for a content-addressed path, or leave the argument out. The other arguments are bynk.http.cache_bad_max_age and bynk.http.cache_bad_scope.

Example

@cache(maxAge: 365.days, immutable: yes) // ✗ `true` or `false`
on GET("/dl/:hex") (hex: String) -> Effect[HttpResult[String]] by v: Visitor { … }
@cache(maxAge: 365.days, immutable: true) // ✓
on GET("/dl/:hex") (hex: String) -> Effect[HttpResult[String]] by v: Visitor { … }

In the Book

See also

  • Every code in its category, HTTP, on the diagnostic index.
  • bynk explain bynk.http.cache_bad_immutable shows the same from the installed toolchain, without a network.