I am trying to cache the result from an ajax call using memoize
function from Underscore.js
. I am not sure of my implementation. Also how to retrieve b
If you are using Angular.js's $http
, you probably just want to pass {cache : true}
as a second parameter to the get
method.
To store values using key value pairs, you may want to use $cacheFactory, as described in other answers like here. Basically:
var cache = $cacheFactory('cacheId');
cache.put('states', 'value');
cache.get('states');