ha-store icon indicating copy to clipboard operation
ha-store copied to clipboard

Implement cache tiers

Open fed135 opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe. Sometimes it would be great to have fast, in-memory lookups, then fallback to remote (redis, for example) lookups.

Describe the solution you'd like Having the stores as a list would enable tiered lookups, for example:

const {store, Storage} = require('ha-store');
const redis = require('ha-store-redis');

const itemStore = store({
  resolver: getItems,
  delimiter: ['language'],
  stores: [
    Storage.InMemory,
    redis,
  ],
});

Describe alternatives you've considered None considered right now

Additional context This was requested by a user that currently uses redis storage but would also see benefits from using in-memory first.

fed135 avatar Jun 29 '22 15:06 fed135