runtime-cache

Implements Vercel Runtime Cache key-value storage with tag-based invalidation for serverless functions.

Updated Sep 5, 2026
One-click install
npx skills add https://github.com/dsgalkar/dnyaneshwar_portfolio --skill runtime-cache-dsgalkar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: runtime-cache
Source: https://github.com/dsgalkar/dnyaneshwar_portfolio/tree/main/.agents/plugins/vercel/skills/runtime-cache
Command: npx skills add https://github.com/dsgalkar/dnyaneshwar_portfolio --skill runtime-cache-dsgalkar

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @vercel/functions.

What problem does it solve? Caching data across Vercel serverless functions, routing middleware, and builds is difficult because instances are ephemeral and regional. This Skill provides guidance for using the Vercel Runtime Cache API to store, retrieve, and invalidate cached data with tags, avoiding redundant database queries and external API calls. ## Core Features & Use Cases - Key-Value Cache Operations: Set, get, and delete cached entries with TTL, tags, and namespaces via the @vercel/functions package. - Tag-Based Invalidation: Expire groups of cached entries with expireTag, or purge across CDN, Runtime, and Data caches with invalidateByTag and dangerouslyDeleteByTag. - Next.js Integration: Use 'use cache: remote' with cacheTag and cacheLife in Next.js 16, plus the updated revalidateTag and updateTag invalidation APIs. - Use Case: A CMS webhook triggers a server action that calls expireTag('blog'), invalidating all cached blog posts across functions in the region within 300ms. ## Quick Start Ask the AI to add Vercel Runtime Cache caching with tag-based invalidation to an API route using @vercel/functions.

Frequently Asked Questions about runtime-cache

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use the Vercel Runtime Cache API?

Import getCache from @vercel/functions, then call cache.set with a key, value, TTL, and tags. Use cache.get to retrieve values and cache.delete to remove specific keys. The cache is regional and shared across functions in the same project and deployment environment.

How do I invalidate cached data by tag on Vercel?

Call cache.expireTag with one or more tags to invalidate Runtime Cache entries, propagating globally within 300ms. To purge across CDN, Runtime, and Data caches together, use invalidateByTag for stale-while-revalidate or dangerouslyDeleteByTag for hard deletion.

What is the difference between 'use cache' and 'use cache: remote' in Next.js?

'use cache' stores data in-memory per instance and is ephemeral. 'use cache: remote' stores data in the Vercel Runtime Cache, making it persistent across deployments and shared across function instances in a region.

Does revalidateTag invalidate the Vercel Runtime Cache?

No. Next.js revalidateTag and revalidatePath do not invalidate the Runtime Cache, and cache.expireTag does not invalidate ISR pages. To purge all cache layers with one tag, use invalidateByTag from @vercel/functions.

What are the limits of Vercel Runtime Cache?

Items are limited to 2 MB, with up to 64 tags per Runtime Cache item and 128 per CDN item. Tags are case-sensitive, cannot contain commas, and are capped at 256 bytes. The cache is ephemeral with LRU eviction when full.

When should I not use the Vercel Runtime Cache?

Avoid it for persistent storage, cross-region shared state, or user-specific data that varies per request. Use a database like Neon or Upstash for persistence, Cache-Control headers for CDN-level response caching, and Next.js Cache Components for framework-level page caching.