Efficient data fetching for your Javascript Applications
https://ha-store.js.org โ HEALTH ? 96 / Healthy
Efficient data fetching for your Javascript Applications
https://ha-store.js.org โ// readme
High-Availability store Efficient data fetching to prevent thundering herds!
HA-store is a wrapper for your data queries, it features:
Learn how you can improve your appโs performance, design and resilience here!
npm install ha-store
// Create your store
import HAStore, {caches} from 'ha-store';
const itemStore = HAStore({
resolver: getItems,
delimiter: ['language'],
caches: [
caches.inMemory({
limit: 1000, // Maximum number of cached items
ttl: 60000, // Time to live: 60 seconds
}),
],
});
// Define your resolver
function getItems(ids, params, contexts) {
// Ids will be a list of all the unique requested items
// Params will be the parameters for the request, which must be declared in the `delimiter` config of the store
// Contexts will be the list ofโฆ