npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@revealui/cache

v0.2.2

Published

Framework-agnostic CDN config, edge cache, ISR-style presets, and revalidation helpers. Compatible with NextRequest/NextResponse, Hono, and Cloudflare Workers via structural typing — no `next` peer dep.

Readme


title: "@revealui/cache" description: "Caching infrastructure for RevealUI applications. Provides CDN cache configuration, edge cache helpers, ISR presets, tag-based revalidation, and rate limiting at the edge." visibility: public status: verified audience: user

@revealui/cache

Caching infrastructure for RevealUI applications. Provides CDN cache configuration, edge cache helpers, ISR presets, tag-based revalidation, and rate limiting at the edge.

When to Use This

  • You need Cache-Control headers for CDN responses (Vercel, Cloudflare)
  • You want ISR presets for Next.js pages (static, dynamic, real-time)
  • You need tag-based cache invalidation when content changes
  • You want edge-level rate limiting or A/B test variant assignment
  • You need cache warming for static paths

If you're caching in-memory data within a single request, use standard Map or LRU - this package is for HTTP-layer and CDN caching.

Installation

pnpm add @revealui/cache

No peer dependencies. ISR helpers use structural typing compatible with NextRequest/NextResponse, Hono, and Cloudflare Workers - no next package required.

API Reference

CDN Configuration

| Export | Type | Purpose | |--------|------|---------| | generateCacheControl | Function | Build Cache-Control header string from config | | getCacheTTL | Function | Get TTL for a content type | | CDN_CACHE_PRESETS | Object | Pre-built configs (static, api, dynamic, immutable) | | DEFAULT_CDN_CONFIG | Object | Default CDN configuration | | generateCacheTags | Function | Generate cache tags for content-based invalidation | | generateVercelCacheConfig | Function | Vercel-specific cache headers | | generateCloudflareConfig | Function | Cloudflare-specific cache config | | shouldCacheResponse | Function | Determine if a response should be cached |

CDN Purge

| Export | Type | Purpose | |--------|------|---------| | purgeCDNCache | Function | Purge CDN cache by URL patterns | | purgeCacheByTag | Function | Purge by cache tag (content-type based) | | purgeAllCache | Function | Full CDN cache purge | | warmCDNCache | Function | Pre-warm cache for a list of URLs |

Edge Cache & ISR

| Export | Type | Purpose | |--------|------|---------| | ISR_PRESETS | Object | Next.js ISR configs (static: 1h, dynamic: 60s, realtime: 10s, immutable: 1y) | | revalidatePath | Function | Revalidate a single Next.js path | | revalidatePaths | Function | Batch path revalidation | | revalidateTag | Function | Revalidate by cache tag | | revalidateTags | Function | Batch tag revalidation | | generateStaticParams | Function | Helper for Next.js static generation | | setEdgeCacheHeaders | Function | Set edge-specific cache headers on response | | createEdgeCachedFetch | Function | Fetch wrapper with edge caching | | createCachedFunction | Function | Memoize an async function with TTL | | warmISRCache | Function | Pre-warm ISR cache for static paths | | addPreloadLinks | Function | Add Link: <url>; rel=preload headers |

Edge Utilities

| Export | Type | Purpose | |--------|------|---------| | EdgeRateLimiter | Class | Token bucket rate limiter for edge functions | | getGeoLocation | Function | Extract geo data from edge request headers | | getABTestVariant | Function | Deterministic A/B test variant assignment | | getPersonalizationConfig | Function | Edge personalization based on geo/device |

Invalidation Channel

| Export | Type | Purpose | |--------|------|---------| | CacheInvalidationChannel | Class | Distributed cache busting via pub/sub channel |

Configuration

| Export | Type | Purpose | |--------|------|---------| | configureCacheLogger | Function | Set custom logger (defaults to console) |

Subpath Exports

| Subpath | Contents | |---------|----------| | @revealui/cache | All cache utilities | | @revealui/cache/adapters | CacheStore interface + implementations (for custom backends) |

Design Principles

  • Adaptive: ISR presets scale from real-time (10s) to immutable (1y) based on content volatility
  • Unified: Cache tags follow the same taxonomy as CMS collections - invalidation is automatic
  • Orthogonal: Caching is a separate concern from content serving - swap CDN providers without changing business logic

Related Packages

  • apps/server - Applies cache headers to REST responses
  • apps/marketing - Uses ISR presets for marketing pages
  • @revealui/core - Triggers cache invalidation on content changes