Skip to content
Playground(another site)

bynk.cloudflare.edge_cache_in_agent

Error An agent handler reaches an EdgeCache instance, directly or through a provider's given; an agent's purge would not reach the Worker's cache.

A purge reaches the edge cache only when it runs in the Worker's own fetch. An agent runs in a Durable Object, so an agent handler that reaches EdgeCache, with given Edge or through a provider that does, would not reach this Worker's cache. Purge from the service handler that calls the agent. A queue consumer and an on schedule handler have the same rule: bynk.cloudflare.edge_cache_in_queue, bynk.cloudflare.edge_cache_in_schedule.

Example

capability Edge = EdgeCache
agent Index {
key name: String
store hits: Cell[Int]
on call withdraw(path: String) -> Effect[Bool] given Edge { // ✗ an agent's purge misses the Worker's cache
Edge.purge([path])
}
}
service operator from http {
on POST("/purge/:hex") (hex: String) -> Effect[HttpResult[Bool]] by v: Visitor given Edge { // ✓ purge from a service handler
let purged <- Edge.purge(["/dl/\(hex)"])
Ok(purged)
}
}

In the Book

See also

  • Every code in its category, Cloudflare, on the diagnostic index.
  • bynk explain bynk.cloudflare.edge_cache_in_agent shows the same from the installed toolchain, without a network.