In-memory cache implementation with LRU eviction and lazy TTL expiry.
On get of a live entry, the entry is deleted and re-inserted (moves to
MRU position). On set, if the map exceeds maxSize, the oldest entry
(first Map key) is evicted. Expired entries are lazily deleted on read
(get/has).
The constructor accepts a prefix for interface parity with other backends,
but MemoryStore intentionally does not use it: each plugin instance owns
its own Map, so emptying it in clear() naturally scopes to this instance.
clear(): Promise<void>
Remove all entries scoped to this backend's prefix.
The prefix is provided at construction time (not per-call), so each backend can scope the clear appropriately:
- Redis:
SCAN MATCH ${prefix}*+ batch DEL - Memory: empty the internal map (each plugin instance owns its own map, so it naturally holds only this prefix's keys)
connect(): Promise<void>
Establish the backend connection (if applicable).
delete(key: string): Promise<boolean>
Delete a value. The key is already-prefixed by CacheService.
disconnect(): Promise<void>
Gracefully disconnect.
get<T>(key: string): Promise<T | null>
Read a value. The key is already-prefixed by CacheService.
has(key: string): Promise<boolean>
Check existence. The key is already-prefixed by CacheService.
isHealthy(): Promise<boolean>
Lifecycle truth (M90b): an in-process Map has no separate backend to reach, so reachability IS readiness — the process either holds the map or it does not.
isReady(): boolean
Reports whether the backend is ready for operations.
set<T>(key: string,value: T,ttlSeconds?: number): Promise<void>
Write a value. The key is already-prefixed by CacheService.