caching-patterns
Installation
SKILL.md
Caching Patterns
Couchbase works as a cache natively — every document can have a TTL, and the KV API is sub-millisecond. No separate Redis instance needed.
TTL / Expiry
Set expiry on any KV operation. The document is automatically deleted when it expires.
// Node.js — expiry in seconds
await collection.upsert('session::abc123', { userId: 'alice', cart: [] },
{ expiry: 3600 } // 1 hour
);
// Insert with expiry (fails if key exists)
await collection.insert('rate::ip::1.2.3.4', { count: 0 },
{ expiry: 60 } // 1 minute window
);