Skip to main content

Features

Overview

FeatureStatusNotes
Cache Operationsget, set, del
TTL ManagementAutomatic key expiration
Conditional CachingToggle via CACHE_ENABLED
Error HandlingGraceful fallback on failures
Framework IntegrationImplements Cache.Service
CMS IntegrationUsed by Strapi/Contentful

Cache operations

interface CacheService {
get(key: string): Promise<string | undefined>;
set(key: string, value: string): Promise<void>;
del(key: string): Promise<void>;
}

All operations are no-ops when CACHE_ENABLED=false or Redis is unavailable.

TTL management

  • All keys expire after CACHE_TTL seconds (default: 300)
  • Each key has independent expiration based on when it was set
  • No manual TTL management required

Connection behavior

  • Connection established only when CACHE_ENABLED=true
  • No automatic reconnection on connection loss (restart required)
  • All errors are logged but don't crash the application

CMS integration

CMS integrations cache content using consistent key patterns:

component-{id}-{locale}
page-{id}-{locale}
app-config-{locale}

Cache flow:

  1. Check cache for content
  2. If cached → return immediately
  3. If not cached → fetch from CMS API → store in cache → return

Limitations

  • No auto-reconnection: Restart required if connection lost
  • String values only: Objects must be serialized (JSON.stringify or flatted)
  • No tag-based invalidation: Keys must be deleted manually
  • Single instance: No built-in Sentinel/Cluster support