Skip to content
Playground(another site)

bynk.http.cache_duplicate

Error A handler carries more than one @cache annotation.

A handler has one @cache, which says how long the response to that route may be reused. Two would give it two freshness windows, and neither could be said to win, so the second is refused. Delete the one you do not want. A handler may likewise carry only one @limit (bynk.http.limit_duplicate), @raw or @json.

Example

@cache(maxAge: 1.minute)
@cache(maxAge: 5.minutes) // ✗ already cached above
on GET("/links") () -> Effect[HttpResult[String]] by v: Visitor { … }
@cache(maxAge: 5.minutes) // ✓ one window
on GET("/links") () -> 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_duplicate shows the same from the installed toolchain, without a network.