l1l2-cache-patterns

Community

Two-tier caching for tenant microservices.

AuthorPremModhaOfficial
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Two-tier caching reduces database load and latency in multi-tenant microservices by keeping hot data in an in-process L1 cache and a shared L2 cache, while ensuring tenant isolation.

Core Features & Use Cases

  • L1: In-process freecache per replica with tenant-keyed keys and 60s TTL for GET-by-ID lookups.
  • L2: Dragonfly, a Redis-compatible shared cache with tenant-keyed keys and 300s TTL, checked by DAL before hitting PostgreSQL.
  • Cache invalidation: NATS events from DAL to entity services keep L1 and L2 coherent; NATS KV Store is not used for caching.

Quick Start

Configure per-replica L1 freecache and shared L2 Dragonfly, and wire NATS-based invalidation to enable tenant-aware GET-by-ID caching.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: l1l2-cache-patterns
Download link: https://github.com/PremModhaOfficial/motadata-ai-pipeline/archive/main.zip#l1l2-cache-patterns

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.