@expo/entity-secondary-cache-local-memory
Cross-request LRU secondary cache for @expo/entity
. Use
this cache with caution - it is nonstandard. The cache is shared between requests in the node process.
EntitySecondaryCacheLoader
, in this example TestEntitySecondaryCacheLoader
. The underlying data can come from anywhere, but an entity is constructed from the data and then authorized for the viewer.EntitySecondaryCacheLoader
, passing in a LocalMemorySecondaryEntityCache
.const secondaryCacheLoader = new TestSecondaryLocalMemoryCacheLoader(
new LocalMemorySecondaryEntityCache(
GenericLocalMemoryCacher.createLRUCache<LocalMemoryTestEntityFields>({})
),
LocalMemoryTestEntity.loader(viewerContext)
);
const loadParams = { id: createdEntity.getID() };
const results = await secondaryCacheLoader.loadManyAsync([loadParams]);