angular-cache - How to set new data in same key with different maxAge?
Closed this issue · 2 comments
ido-lempert commented
I want to create default cache with maxAge of 2s for all AJAX calls, and I want to override specific key with different maxAge for example 30s.
app.run(function ($http, DSCacheFactory) {
DSCacheFactory('defaultCache', {
maxAge: 1000 * 2,
cacheFlushInterval: 6000000,
deleteOnExpire: 'aggressive'right when they expire.
});
$http.defaults.cache = DSCacheFactory.get('defaultCache');
});
I tried to do something like this:
var defaultCache = DSCacheFactory.get('defaultCache');
defaultCache.put('resource/id', {fullName : 'Ronen Cohen'}, {maxAge : 1000 * 30});
jmdobry commented
You can do so with angular-cache 2.x. someCache.put('things', { stuff: 'lots of stuff' }, { maxAge: 15000 });
jmdobry commented
Closing because I’m not sure this is an issue, if you are convinced that this is really a bug, please feel free to re-open the issue and add more information:
- good - Your versions of Angular, Angular-cache, etc, relevant console logs/error, code examples that revealed the issue
- better - A plnkr, fiddle, or bin that demonstrates the issue
- best - A Pull Request that fixes the issue, including test coverage for the issue and the fix
Otherwise support is done via the mailing list.