Skip to content
Playground(another site)

bynk.store.cache_needs_clock

Error A handler performs a Cache operation (TTL expiry reads the clock) without declaring given Clock.

A Cache entry expires, and every operation on it but remove reads the clock to decide whether an entry is still live. So a handler that uses a Cache must declare given Clock, the same way one that reads the time itself would; the dependency is explicit even though the body never names the clock. Add given Clock to the handler's signature.

Example

consumes bynk { Clock }
store live: Cache[String, Int] @ttl(5.minutes)
on call touch() -> Effect[()] {
let _ <- live.put("a", 1) // ✗ expiry reads the clock, which the handler does not declare
Effect.pure(())
}
on call touch() -> Effect[()] given Clock { // ✓ declare the clock
let _ <- live.put("a", 1)
Effect.pure(())
}

In the Book

See also

  • Every code in its category, Agent storage, on the diagnostic index.
  • bynk explain bynk.store.cache_needs_clock shows the same from the installed toolchain, without a network.