cache — memoize handler results by (action, target) key. Use with query() for read-only commands. The plugin intercepts the dispatch/query pipeline and returns the cached result if fresh.
query()
Manually invalidate a cache entry.
Optional
Clear the entire cache.
Current cache size.
bus.use(cache({ ttl: 60_000, actions: ['getUser*'] }));bus.query('getUser', { id: 42 }); // handler runsbus.query('getUser', { id: 42 }); // cache hit, handler skipped Copy
bus.use(cache({ ttl: 60_000, actions: ['getUser*'] }));bus.query('getUser', { id: 42 }); // handler runsbus.query('getUser', { id: 42 }); // cache hit, handler skipped
cache — memoize handler results by (action, target) key. Use with
query()for read-only commands. The plugin intercepts the dispatch/query pipeline and returns the cached result if fresh.