DBCache.get()method
Get (or create) the CollectionCache for the given collection.
get(collection: Collection<string, II, TT>): CollectionCache<II, TT>
get(collection: Collection<string, I, T>): CollectionCache<I, T>
new DBCache<I, T>(provider: DBProvider<I, T>)
| Param | Type | |
|---|---|---|
provider | DBProvider<I, T> | The database provider the cached stores fetch from. required |
| Return | |
|---|---|
DBCache<I, T> | Cache of CollectionCache objects for multiple collections. |
| Property | Type | |
|---|---|---|
.provider | DBProvider<I, T> | The database provider the cached stores fetch from. required readonly |
.memory | MemoryDBProvider<I, T> | Memory provider reused from the provider chain to seed stores synchronously, if available. readonly |
Cache of CollectionCache objects for multiple collections.
get(collection) to retrieve or create the CollectionCache for a given collection,getItem(id) / getQuery(query) on that to get a specific store.CacheDBProvider, its memory is reused so stores can seed synchronously.const cache = new DBCache(provider); const store = cache.getItem(collection, "abc");
Get (or create) the CollectionCache for the given collection.
get(collection: Collection<string, II, TT>): CollectionCache<II, TT>
get(collection: Collection<string, I, T>): CollectionCache<I, T>
Get (or create) an ItemStore for a collection/id in one hop.
getItem(collection: Collection<string, II, TT>, id: II): ItemStore<II, TT>
Get (or create) a QueryStore for a collection/query in one hop.
getQuery(collection: Collection<string, II, TT>, query: Query<Item<II, TT>>): QueryStore<II, TT>
Refresh a specific item store for a collection.
refreshItem(collection: Collection<string, II, TT>, id: II, maxAge?: number): Promise<void>
Refresh every cached item store for a collection.
refreshItems(collection: Collection<string, II, TT>, maxAge?: number): Promise<void>
Refresh a specific query store for a collection.
refreshQuery(collection: Collection<string, II, TT>, query: Query<Item<II, TT>>, maxAge?: number): Promise<void>
Refresh every cached query store for a collection.
refreshQueries(collection: Collection<string, II, TT>, maxAge?: number): Promise<void>
Refresh every cached store (items and queries) for a collection.
refreshAll(collection: Collection<string, II, TT>, maxAge?: number): Promise<void>