Caching

Use namespaced portable caches with typed serialization, tag invalidation, and explicit stampede-protection capabilities across Redis, Workers, and local runtimes.

Supported approaches

Namespaced key-value caching

available

Keep application and environment boundaries in every physical key while preserving direct access to the configured storage client.

Packages

@playstack/cache

Stampede-protected remember

available

Load a missing value once with process-local or distributed locking declared by the selected adapter.

Frameworks and integrations

Tag invalidation

available

Invalidate related keys through versioned tags without provider-specific key scans or hidden global state.

Frameworks and integrations

framework

Next.js

Compose Playstack server contracts, React bindings, SSR handoff, and route adapters at the Next.js application edge.

framework

NestJS

Connect portable Playstack capabilities to dependency injection, guards, decorators, request context, workers, and lifecycle hooks.

integration

Redis

Use Redis for distributed caches, rate-limit counters, and BullMQ-backed jobs while keeping application policy portable.

framework

Cloudflare Workers

Run portable contracts in Web-standard runtimes with explicit Workers KV, R2, Queues and Durable Object adapters.

integration

Cloudflare Workers KV

Use an application-supplied Workers KV binding for namespaced cache storage with explicitly eventual capabilities.

Package reference

@playstack/cache

Own the namespace

Every cache instance receives an application and environment identity. Physical keys therefore remain safe when multiple products, previews, workers, or test suites share one provider.

ts
import { createCache } from '@playstack/cache'
import { RedisCacheStorage } from '@playstack/cache/redis'

export const cache = createCache({
  app: 'billing',
  environment: 'production',
  driver: new RedisCacheStorage(redis),
  lockTtlMs: 30_000,
})

const plan = await cache.remember(
  'plans:pro',
  60_000,
  () => plans.load('pro'),
)

Invalidate by domain fact

ts
const accountCache = cache.tags('accounts', `account:${account.id}`)

await accountCache.put('summary', summary, 60_000)
await accountCache.flush()

Tag versions avoid provider key scans. An adapter declares whether invalidation is immediate or eventual and whether stampede protection is process-local or distributed, so an application can reject a capability mismatch during configuration.

Keep failure policy visible

Serialization, lock timeouts, and provider unavailability have distinct stable errors. The application decides whether a specific read may fail open, retry, or bypass the cache; the package does not silently turn an infrastructure failure into a miss.

Go

Playstack Pro tag
OriginsPricingBlogNewsletterChangelogStatusRoadmap
ContributorsCommunityIn Use ShowcaseCase StudiesPartnersSponsors
FAQsSupportContact

© 2026 Playstack. All rights reserved.

With OSS
Terms of ServicePrivacy PolicyCookie PolicyImprint

By

Commune Software