superfly / fly

Deploy app servers close to your users. Package your app as a Docker image, and launch it in 17 cities with one simple CLI.
https://fly.io
985 stars 48 forks source link

feat: large object cache #220

Closed michaeldwan closed 5 years ago

michaeldwan commented 5 years ago

We're releasing a new tool for caching data that's too large for the in-memory store, such as images and video. See #214 for initial discussion and the example app.

Basic usage

Fetch data from the cache:

await fetch("cache://image.jpg")
if (!resp.ok) {
  // 404, cache miss
} 

Put data in the cache:

await fetch("cache://image.jpg", {
  body: originResponse.body,
  method: "PUT",
  headers: { ... }
})

Remove data from the cache:

await fetch("cache://image.jpg", { method: "DELETE" })