InMemoryCache
@rotorsoft/act-root / act/src / InMemoryCache
Class: InMemoryCache
Defined in: libs/act/src/adapters/InMemoryCache.ts:18
In-memory LRU cache for stream snapshots.
Uses a Map (insertion-ordered) for O(1) get/set with LRU eviction.
Configurable maxSize bounds memory usage.
Example
import { cache } from "@rotorsoft/act";
import { InMemoryCache } from "@rotorsoft/act";
cache(new InMemoryCache({ maxSize: 500 }));
Implements
Constructors
Constructor
new InMemoryCache(
options?):InMemoryCache
Defined in: libs/act/src/adapters/InMemoryCache.ts:22
Parameters
options?
maxSize?
number
Returns
InMemoryCache
Accessors
size
Get Signature
get size():
number
Defined in: libs/act/src/adapters/InMemoryCache.ts:62
Returns
number
Methods
clear()
clear():
Promise<void>
Defined in: libs/act/src/adapters/InMemoryCache.ts:54
Returns
Promise<void>
Implementation of
dispose()
dispose():
Promise<void>
Defined in: libs/act/src/adapters/InMemoryCache.ts:58
Returns
Promise<void>
Implementation of
Cache.dispose
get()
get<
TState>(stream):Promise<CacheEntry<TState> |undefined>
Defined in: libs/act/src/adapters/InMemoryCache.ts:26
Type Parameters
TState
TState extends Schema
Parameters
stream
string
Returns
Promise<CacheEntry<TState> | undefined>
Implementation of
invalidate()
invalidate(
stream):Promise<void>
Defined in: libs/act/src/adapters/InMemoryCache.ts:50
Parameters
stream
string
Returns
Promise<void>
Implementation of
set()
set<
TState>(stream,entry):Promise<void>
Defined in: libs/act/src/adapters/InMemoryCache.ts:37
Type Parameters
TState
TState extends Schema
Parameters
stream
string
entry
CacheEntry<TState>
Returns
Promise<void>