ComputedCache
See source codeA computed cache that stores derived data for records. The cache automatically updates when underlying records change and cleans up when records are deleted.
interface ComputedCache<Data, R extends UnknownRecord> {}
Example
const expensiveCache = store.createComputedCache('expensive', (book: Book) =>
performExpensiveCalculation(book)
)
const result = expensiveCache.get(bookId)
Methods
get
Get the cached data for a record by its ID.
Parameters
Name | Description |
---|---|
|
The ID of the record |
Returns
Data | undefined
The cached data or undefined if the record doesn't exist
Prev
CollectionDiffNext
CreateComputedCacheOpts