Storage

Overview

How nuxt-unleash caches feature flags across different runtimes.

How It Works

nuxt-unleash caches feature flag data from your Unleash Proxy using a stale-while-revalidate strategy:

First request

On server startup (or first request with an empty cache), the module fetches flags synchronously from the Unleash Proxy and stores them.

Subsequent requests

Each request reads flags from the cache. If the cache is fresh (younger than refreshInterval), flags are returned immediately with no network call.

Stale cache

If the cache is older than refreshInterval, the current (stale) flags are returned immediately and a background refresh is triggered. The next request gets fresh data.

Deduplication

A lock prevents multiple concurrent requests from triggering multiple refreshes. Only one fetch runs at a time.

Storage Backends

Choose a storage backend based on your deployment target:

BackendBest forPersistenceConfig
NuxtHubCloudflare Workers via NuxtHubKV storestorage: 'nuxthub'
NitroCustom drivers (CF KV, Redis, etc.)Driver-dependentstorage: 'nitro'
MemoryDevelopment, simple Node.jsIn-process onlystorage: 'memory'
NuxtHub is the recommended backend. It provides persistent KV storage that works across Cloudflare Workers invocations with zero configuration.
Copyright © 2026