runtime-cache

Implements Vercel Runtime Cache operations with tag-based invalidation for serverless functions.

Updated Jul 31, 2026
One-click install
npx skills add https://github.com/AarnavBaddam/skills --skill runtime-cache-aarnavbaddam
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: runtime-cache
Source: https://github.com/AarnavBaddam/skills/tree/main/runtime-cache
Command: npx skills add https://github.com/AarnavBaddam/skills --skill runtime-cache-aarnavbaddam

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @vercel/functions.

What problem does it solve? Caching data across serverless function invocations is difficult because each instance is ephemeral and isolated. This Skill provides guidance for using the Vercel Runtime Cache API to share cached data across Functions, Routing Middleware, and Builds with tag-based invalidation. ## Core Features & Use Cases - Key-Value Cache Operations: Set, get, and delete cached entries with TTL, tags, and namespaces via @vercel/functions. - 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 data across functions in the region within 300ms. ## Quick Start Ask the AI to implement a cached API route using the Vercel Runtime Cache with a one-hour TTL and a tag for later invalidation.

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 in a serverless function?

Import getCache from @vercel/functions, then call cache.set with a key, value, TTL, and tags, and cache.get to retrieve values. The cache is shared across Functions, Routing Middleware, and Builds within the same region and deployment environment.

What is the difference between expireTag and invalidateByTag in Vercel?

expireTag operates only on the Runtime Cache, expiring entries with a given tag within about 300ms. invalidateByTag purges across all three cache layers: CDN, Runtime Cache, and Data Cache, using stale-while-revalidate semantics.

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 both, use the same tag and call invalidateByTag from @vercel/functions, which hits all cache layers.

How does 'use cache: remote' work in Next.js 16?

The 'use cache: remote' directive stores the function result in the Vercel Runtime Cache instead of per-instance memory. Combine it with cacheTag and cacheLife from next/cache, and enable cacheComponents in next.config.ts.

What are the limits of the 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 evicts entries via LRU when full.

When should I not use the Vercel Runtime Cache?

Avoid it for persistent storage (use a database like Neon or Upstash), cross-region shared state, framework-level page caching (use Next.js Cache Components), and user-specific data that differs per request.