@expo/entity-secondary-cache-local-memory
TypeScript icon, indicating that this package has built-in type declarations

0.39.0 • Public • Published

@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.

Documentation

Usage

  1. Create a concrete implementation of abstract class 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.
  2. Create an instance of your EntitySecondaryCacheLoader, passing in a LocalMemorySecondaryEntityCache.
    const secondaryCacheLoader = new TestSecondaryLocalMemoryCacheLoader(
      new LocalMemorySecondaryEntityCache(
        GenericLocalMemoryCacher.createLRUCache<LocalMemoryTestEntityFields>({})
      ),
      LocalMemoryTestEntity.loader(viewerContext)
    );
  3. Load entities through it:
    const loadParams = { id: createdEntity.getID() };
    const results = await secondaryCacheLoader.loadManyAsync([loadParams]);

Readme

Keywords

Package Sidebar

Install

npm i @expo/entity-secondary-cache-local-memory

Weekly Downloads

455

Version

0.39.0

License

MIT

Unpacked Size

25.4 kB

Total Files

15

Last publish

Collaborators

  • douglowder
  • betoatexpo
  • philpl
  • expo-bot
  • szdziedzic
  • alanhughes
  • kadikraman
  • radoslawkrzemien
  • aleqsio
  • marklawlor
  • gabrieldonadel
  • simek
  • keith-kurak
  • fiber-god
  • ide
  • brentvatne
  • evanbacon
  • quinlanj
  • expoadmin
  • tsapeta
  • exponent
  • wschurman
  • bycedric
  • lukmccall
  • jonsamp
  • princefleaswallow
  • kudochien