Skip to content

Cache worker response for particular tickets, and purge it on deletion #9

Description

@pawelgrzybek

CF Workers finally support intuitive way of caching.
https://blog.cloudflare.com/workers-cache/

We should use this feature to cache all the individual ticket responses, and purge the cache tag associated with this ticket after deletion.

return new Response(body, {
  headers: {
    "Cache-Control": "public, max-age=300, stale-while-revalidate=3600",
    "Cache-Tag": "ticket:123",
  },
});
await ctx.cache.purge({ tags: ["ticket:123"] });

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions