angularjs-query-cache

1.0.2 • Public • Published

angularjs-query-cache


Sometimes you want to keep the result to a query you made previously. This module decorates the $http service to add better caching.

This module uses sessionStorage which means restarting the browser will reset the cache.

Usage

Set the _cache field to true in the options object when making a get request using $http. Optionally, you can see the max age (in milliseconds) on individual calls through the _maxAge key.

var opts = { 
  _cache: true, 
  _maxAge: 5 * 60 * 1000 // <- this is the default value (5 minutes)
}
 
$http.get('https://api.my-service.io/endpoint', opts)

Installation

Using npm:

npm install --save angularjs-query-cache

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i angularjs-query-cache

      Weekly Downloads

      1

      Version

      1.0.2

      License

      MIT

      Unpacked Size

      6.49 kB

      Total Files

      5

      Last publish

      Collaborators

      • kareniel