@expo/entity-secondary-cache-redis
ioredis secondary cache for @expo/entity
.
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 RedisSecondaryEntityCache
.const secondaryCacheLoader = new TestSecondaryRedisCacheLoader(
new RedisSecondaryEntityCache(
redisTestEntityConfiguration,
genericRedisCacheContext,
(loadParams) => `${loadParams.id}`
),
RedisTestEntity.loader(viewerContext)
);
const loadParams = { id: createdEntity.getID() };
const results = await secondaryCacheLoader.loadManyAsync([loadParams]);