Skip to main content

Introducing the Runtime Cache API

By Steven Van ·

The new getCache method lets Vercel Functions read and write region-scoped cache entries with tag-based invalidation, billed per region.

Vercel functions can now read and write to the platform's Runtime Cache directly, through a new getCache method in Vercel's @vercel/functions package. The Runtime Cache is an ephemeral, region-scoped cache shared across Functions, Routing Middleware, and Builds.

  • getCache returns an object with get, set, delete, and expireTag methods; set accepts an optional ttl and an array of tags.
  • Calling expireTag invalidates every cache entry carrying that tag, and the change propagates across all Vercel regions within 300ms.
  • Cached items are capped at 2MB, with a maximum of 128 tags per item and a 256-byte limit per tag.
  • On the Hobby plan, all projects in a team share one cache; on Pro and Enterprise, each project gets its own.
  • Hit rates, invalidation patterns, and storage usage can be tracked in the Observability dashboard's Runtime Cache tab. Reads and writes are billed by the runtime region.
Vercel
Vercel
The platform for frontend developers — deploy, preview, and scale web apps and AI agents with zero config.
View Vercel →

Original source

Read Introducing the Runtime Cache API on Creators Toolbox