API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classMemoryCacheStore

@codexo/exojs / assets / stable

CacheStore that keeps records in a `Map` for the lifetime of the process. Holds values BY REFERENCE - no cloning, no serialization - so it accepts anything at all and is as fast as a lookup, but does not isolate a caller from later mutation of a stored object and does not survive a reload. Its usual place is in front of a persistent store, where a hit avoids the asynchronous round trip: ```ts new AssetCache({ read: [new MemoryCacheStore(), idb], write: [idb], promote: true }) ```

1
props
5
methods
0
events
Import
import { MemoryCacheStore } from '@codexo/exojs'

CacheStore that keeps records in a `Map` for the lifetime of the process.

Holds values BY REFERENCE - no cloning, no serialization - so it accepts anything at all and is as fast as a lookup, but does not isolate a caller from later mutation of a stored object and does not survive a reload.

Its usual place is in front of a persistent store, where a hit avoids the asynchronous round trip:

```ts new AssetCache({ read: [new MemoryCacheStore(), idb], write: [idb], promote: true }) ```

Constructors1
new(id: string): MemoryCacheStore
Methods5
clear(namespace?: string): Promise<void>
Removes every record of namespace, or the whole store when it is omitted.
destroy(): void
Synchronously releases any open handles held by the store.
Writes one record, replacing any existing one. Must not resolve before the write is durable in whatever sense the backend offers. A backend with transactions resolves on commit, not on the write request being accepted - otherwise a caller that awaits a write and then reads it back can miss.
Properties1
id: string
Stable identifier for this store, used in diagnostics to name which store of a multi-store route failed.
Source