runtime-cache

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

Updated Aug 21, 2025
One-click install
npx skills add https://github.com/Adithiya-S/AI-Study-Companion --skill runtime-cache-adithiya-s
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: runtime-cache
Source: https://github.com/Adithiya-S/AI-Study-Companion/tree/main/.agents/skills/runtime-cache
Command: npx skills add https://github.com/Adithiya-S/AI-Study-Companion --skill runtime-cache-adithiya-s

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @vercel/functions.

What problem does it solve? Serverless applications need a fast, shared caching layer that works across functions in a region without managing external infrastructure, and this Skill provides expert guidance for implementing the Vercel Runtime Cache API correctly. ## Core Features & Use Cases - Cache Operations: Set, get, delete, and expire cached entries with TTLs, namespaces, and tag-based invalidation via @vercel/functions. - Next.js Integration: Configure 'use cache: remote' directives, cacheTag, cacheLife, and the Next.js 16 revalidation APIs (updateTag, revalidateTag). - CDN Purging: Use invalidateByTag, dangerouslyDeleteByTag, and the vercel cache CLI to purge across CDN, Runtime, and Data cache layers. - Use Case: A CMS webhook triggers a server action that calls cache.expireTag('blog') so all cached blog data across functions in the region is invalidated within 300ms. ## Quick Start Ask the AI to add Vercel Runtime Cache with tag-based invalidation to your 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 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 scoped per project, per region, and per deployment environment.

How do I invalidate cached data by tag on Vercel?▼

Call cache.expireTag('tag') to invalidate Runtime Cache entries, which propagates globally within 300ms. To purge across CDN, Runtime, and Data caches together, use invalidateByTag or dangerouslyDeleteByTag from @vercel/functions.

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, while 'use cache: remote' stores data in the Vercel Runtime Cache shared across functions in a region. The remote directive requires Next.js 16 with cacheComponents enabled.

Does cache.expireTag invalidate Next.js ISR pages?▼

No, Runtime Cache tags do not apply to ISR pages, and revalidatePath or revalidateTag do not invalidate the Runtime Cache. Use invalidateByTag with a shared tag to purge all cache layers at once.

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; storage 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, user-specific per-request data, or framework-level page caching. Use a database like Neon or Upstash for persistence and Cache-Control headers for CDN-level full response caching.