Skip to content
Playground(another site)

bynk.http.cache_max_age_fractional_seconds

Error A @cache annotation's maxAge is positive but does not resolve to a whole number of seconds.

Cache-Control: max-age counts whole seconds. A maxAge such as 1500.milliseconds has a remainder that would be dropped, and the header would say 1 for what you wrote as 1.5, so it is refused rather than quietly truncated. Write a whole number of seconds, rounding it yourself. A maxAge that is not a positive duration at all is bynk.http.cache_bad_max_age.

Example

@cache(maxAge: 1500.milliseconds) // ✗ not a whole number of seconds
on GET("/links") () -> Effect[HttpResult[String]] by v: Visitor { … }
@cache(maxAge: 2.seconds) // ✓

In the Book

See also

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