V Vant Docs

Cache

In-memory cache layer for fast recall.

┌─────────────────────────────────────────────────────┐
│              Cache Layer                            │
│                                                      │
│  Request ──▶ Cache ──▶ Brain                       │
│      │         │                                    │
│      │    [HIT] │                                    │
│      │         ▼                                    │
│     [MISS]───▶ Load ──▶ Store                      │
└─────────────────────────────────────────────────────┘

Why

Quick Start

const cache = require('./lib/cache');

Set

// With TTL (60 seconds)
cache.set('key', 'value', 60000);

// No expiry
cache.set('key', 'value', -1);

Get

const value = cache.get('key');
// Returns value or undefined

Delete

cache.delete('key');

// Clear all
cache.clear();