惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Last Watchdog
The Last Watchdog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Secure Thoughts
MongoDB | Blog
MongoDB | Blog
博客园 - Franky
T
Tor Project blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Google DeepMind News
Google DeepMind News
L
LINUX DO - 最新话题
博客园_首页
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Vercel News
Vercel News
Last Week in AI
Last Week in AI
月光博客
月光博客
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
博客园 - 叶小钗
NISL@THU
NISL@THU
C
Check Point Blog
K
Kaspersky official blog
N
News and Events Feed by Topic
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
A
Arctic Wolf
T
Threatpost
GbyAI
GbyAI
L
LINUX DO - 热门话题
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Privacy & Cybersecurity Law Blog
N
News and Events Feed by Topic
Scott Helme
Scott Helme
P
Privacy International News Feed
The Register - Security
The Register - Security
G
GRAHAM CLULEY
Recorded Future
Recorded Future
Apple Machine Learning Research
Apple Machine Learning Research
C
Cybersecurity and Infrastructure Security Agency CISA
B
Blog
Project Zero
Project Zero
Cyberwarzone
Cyberwarzone
Webroot Blog
Webroot Blog
Microsoft Security Blog
Microsoft Security Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
D
DataBreaches.Net
J
Java Code Geeks
AWS News Blog
AWS News Blog
Help Net Security
Help Net Security
Engineering at Meta
Engineering at Meta
M
MIT News - Artificial intelligence
T
Threat Research - Cisco Blogs
Google DeepMind News
Google DeepMind News

Deno

Deno 2.8 | Deno Claw Patrol: an open-source security firewall for agents | Deno Fresh 2.3: Zero JS by default, View Transitions, and Temporal support | Deno Deno 2.7: Temporal API, Windows ARM, and npm overrides | Deno Build a dinosaur runner game with Deno, pt. 6 | Deno Build a dinosaur runner game with Deno, pt. 5 | Deno Deno Deploy is Generally Available | Deno Introducing Deno Sandbox | Deno Build a dinosaur runner game with Deno, pt. 4 | Deno Build a dinosaur runner game with Deno, pt. 3 | Deno Build a dinosaur runner game with Deno, pt. 2 | Deno React / Next.js Denial-of-Service Vulnerability: Deno Deploy users protected | Deno Deno 2.6: dx is the new npx | Deno Build a dinosaur runner game with Deno, pt. 1 | Deno React Server Functions / Next.js Vulnerability: Deno Deploy users protected | Deno My highlights from the new Deno Deploy | Deno Deno's Other Open Source Projects | Deno How Deno protects against npm exploits | Deno Help Us Raise $200k to Free JavaScript from Oracle | Deno Deno 2.5: Permissions in the config file | Deno Fresh 2.0 Graduates to Beta, Adds Vite Support | Deno Deno 2.4: deno bundle is back | Deno JavaScript™ Trademark Update | Deno What's coming to JavaScript | Deno A brief history of JavaScript | Deno Reports of Deno's Demise Have Been Greatly Exaggerated | Deno An Update on Fresh | Deno How Plaid migrated 100 services to a new database platform 5x faster with Deno | Deno Deno 2.3: Improved deno compile, local npm packages, and more | Deno Add JSR packages with pnpm and Yarn | Deno Zero-config Debugging with Deno and OpenTelemetry | Deno Exploring Art with TypeScript, Jupyter, Polars, and Observable Plot | Deno Deno v Oracle Update 3: Fighting the JavaScript Trademark | Deno Build a custom RAG AI agent in TypeScript and Jupyter | Deno How to get deep traces in your Node.js backend with OTel and Deno | Deno toranoana.deno #20 登録受付中(2025年3月14日) | Deno Node just added TypeScript support. What does that mean for Deno? | Deno The Dino 🦕, the Llama 🦙, and the Whale 🐋 | Deno Publish a lint rule, get a prize | Deno Deno 2.2: OpenTelemetry, Lint Plugins, node:sqlite | Deno If you're not using npm specifiers, you're doing it wrong | Deno How Deno's documentation is evolving | Deno Oracle justified its JavaScript trademark with Node.js—now it wants that ignored | Deno Introducing the JSR open governance board | Deno Intro to Wasm in Deno | Deno Announcing OpenAI on JSR | Deno Deno in 2024 | Deno Goodbye WinterCG, welcome WinterTC | Deno Build a SolidJS app with Deno | Deno Run your Next.js SSR app on Deno Deploy | Deno Solve Advent of Code 2024 with Deno and Win Prizes! | Deno Deno v. Oracle: Canceling the JavaScript Trademark | Deno Deno 2.1: Wasm Imports and other enhancements | Deno Build a Typesafe API with tRPC and Deno | Deno Self-contained Executable Programs with Deno Compile | Deno Build a Database App with Drizzle ORM and Deno | Deno Introducing your new JavaScript package manager: Deno | Deno Announcing Growthbook on JSR | Deno Build an Astro site with Deno | Deno How to convert CommonJS to ESM | Deno Announcing Deno 2 | Deno The Final Touches: What’s New In v2.0.0-rc.10 | Deno Announcing Stable V8 Bindings for Rust | Deno Deno 2.0 Release Candidate | Deno Secure, efficient private npm registries with Cloudsmith and Deno | Deno Painting the Plane as We Fly It: Designing JSR | Deno Deno 1.46: The Last 1.x Release | Deno Protect your cloud spend with new Deno Deploy spend limits | Deno What we got wrong about HTTP imports | Deno Benchmarking AWS Lambda Cold Starts Across JavaScript Runtimes | Deno Announcing Supabase on JSR | Deno Deno 1.45: Workspace and Monorepo Support | Deno Introducing KV Backup for Deno Subhosting | Deno A Gentle Intro to TypeScript | Deno Announcing Hono on JSR | Deno How We Made the Deno Language Server Ten Times Faster | Deno How the Guardian uses Deno to audit accessibility and performance across their 2.7 million articles | Deno Introducing More Flexible Domain Association for Deno Subhosting | Deno The stabilization process of the Standard Library has begun | Deno Deno 1.44: Private npm registries, improved Node.js compat, and performance boosts | Deno How we built a secure, performant, multi-tenant cloud platform to run untrusted code | Deno The Deno Standard Library is now available on JSR | Deno How to document your JavaScript package | Deno Your Low Code Solution Needs an Escape Hatch | Deno Deno 1.43: Improved Language Server performance | Deno How Slack used Deno to save months of engineering effort in launching their new platform | Deno JSR Is Not Another Package Manager | Deno Announcing the Hookdeck SDK on JSR | Deno Announcing the Neon Serverless Driver on JSR | Deno An intro to TSConfig for JavaScript Developers | Deno How we built JSR | Deno How Netlify used Deno Subhosting to build a successful edge functions product | Deno Introducing Simpler Project Creation in Deno Deploy | Deno Deno 1.42: Better dependency management with JSR | Deno Introducing deployctl, the command line interface for Deno Deploy | Deno Introducing JSR - the JavaScript Registry | Deno How to add Monaco to a Next.js app and securely run untrusted user code | Deno Survey Results and Roadmap | Deno Deno 1.41: smaller deno compile binaries | Deno Webhooks suck, but here are alternatives | Deno
Introducing Web Cache API support on Deno Deploy | Deno
2024-08-27 · via Deno

Building a performant API, server, or function should not be complicated. Deno Deploy hosts your code close to your users around the world to minimize latency, and provides a simple KV cloud primitive that reads data from the closest data center, all with just a few clicks or keystrokes.

Today, we’re thrilled to give you even more control over performance with beta support for the Web Cache API in Deno Deploy. Much like the web standard Cache API available in modern browsers, this API offers semi-persistent storage for Request/Response pairs, enabling you to cache network requests and provide fast responses.

In this blog post, we’ll go over how to use the Cache API, what to expect from performance, some details on pricing, and more.

  • Using the Cache API
  • Cache Policy
  • Performance
  • Pricing
  • What’s next

🚨️ Host secure, performant JavaScript or TypeScript in the cloud in less than five minutes on Deno Deploy. Sign up for a free account today. 🚨️

Using the Cache API

In order to use the Cache API, you first open a cache with caches.open() method, which returns a Promise that resolves with the Cache object.

const cache = await caches.open("my-cache");

To retrieve from cache, you can use the cache.match() method, which accepts a Request object as a parameter.

const cachedResponse = await cache.match(request);

Finally, to add a new Request/Response object pair into cache, you can use cache.put():

await cache.put(req, res);

In practice, your web server with the new cache capabilities might look something like this:

const cache = await caches.open("my-cache");

Deno.serve(async (req) => {
  const cached = await cache.match(req);
  if (cached) {
    return cached;
  }

  const res = new Response("cached at " + new Date().toISOString());
  await cache.put(req, res.clone());
  return res;
});

Here’s a more sophisticated example that caches a call to an external API:

const cache = await caches.open("default");

Deno.serve(async (req: Request, ctx) => {
  const clientIp = ctx.remoteAddr.hostname;
  const cacheKey = `http://client-ip.local/${clientIp}`;
  const cached = await cache.match(cacheKey);
  if(cached) return cached;

  const res = await fetch(`https://api.country.is/${clientIp}`);
  if(!res.ok) return res;

  await cache.put(cacheKey, res.clone());
  return res;
});

Note that Cache is currently only supported for Deno Deploy and not Subhosting. For more information on using the Cache API, please refer to our documentation or to see all available Cache methods, please refer to our Cache reference documentation.

Cache Policy

By default, cached data is persisted for an indefinite period of time. While we periodically scan and delete inactive objects, an object is usually kept in cache for at least 30 days.

You can customize object expiration with standard HTTP headers Expires and Cache-Control:


const res = new Response("hello cache", {
  headers: {
    "Expires": new Date(Date.now() + 3600 * 1000).toUTCString(),
  },
});
await cache.put(req, res.clone());


const res = new Response("hello cache", {
  headers: {
    "Cache-Control": "max-age=3600",
  },
});
await cache.put(req, res.clone());

Performance

Under the hood, the Deno Deploy cache API is powered by a multi-tier log-structured merge-tree (LSM) storage engine. Cached data is managed as 512KB “pages”; depending on frequency of access, a page can reside in one or more locations among RAM, local NVMe SSD, or a cloud object store like S3 or GCS. The cache service issues I/O requests to the disk using io_uring, achieving 2.4Gbps throughput and sub-millisecond latency for random I/O workloads when running on one local SSD on GCP.

Pricing

During Web Cache API’s beta period, it will be available for all Deno Deploy users at no cost. While we hope to keep the Cache API free, we’ll closely monitor its usage and incurred costs throughout this beta period to determine if we need to start charging.

If you’re concerned about trying out the Web Cache API on Deno Deploy due to potential costs later, our measured cost of Cache is about 10x lower than that of Deno KV. In the event we end up charging for Web Cache, it will be in a similar ratio.

If pricing remains a concern or blocker for your project or preventing you from trying the Web Cache API, please get in touch. We’d love to learn more about your use case and find a solution that works for everyone.

What’s next

While we continue to improve the Web Cache API, it’s just one of many tools to improve performance. We’re also working to support HTTP caching on Deno Deploy, offering you even more fine grained control over how you serve content and overall performance.

🚨️ Deno 2 is right around the corner 🚨️

In a few days the first “Release Candidate” of Deno 2 will be released.

There are some minor breaking changes in Deno 2.

You’ll be able to get it using deno upgrade rc, but you can already future proof your code by adding the DENO_FUTURE=1 env var today.