background-cache

1.0.0 • Public • Published

background-cache

cache request and update them periodically in background

  • Pass URL to monitor
  • (will try to use radis to load previous value)
  • run cache.get() to get current result of your function
  • will update using your timeout
  • will run your handler or JSON.parse
  • will store result in redis

Default:

  • JSON.parse
  • 40s

see demo.js and test.js for examples

var cached = cache.resource({
    url: "http://echo.jsontest.com/key/value"
});

setTimeout(function(){
    console.log(cached.get());
}, 500);

Readme

Keywords

Package Sidebar

Install

npm i background-cache

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • krzychukula
  • jakubwasilewski