TODO
Aggressively delete expiring items.
$angularCacheFactory('myNewCache', {
maxAge: 90000, // Items added to this cache expire after 15 minutes
aggressiveDelete: true // Items will be actively deleted when they expire
});
Passively delete items when they are requested after they have expired.
$angularCacheFactory('myNewCache', {
maxAge: 90000, // Items added to this cache expire after 15 minutes
aggressiveDelete: false // Items will be actively deleted when they expire
});
Aggressively delete expiring items.
$angularCacheFactory('myNewCache', {
maxAge: 90000, // Items added to this cache expire after 15 minutes
deleteOnExpire: 'aggressive' // Items will be actively deleted when they expire
});
Passively delete items when they are requested after they have expired.
$angularCacheFactory('myNewCache', {
maxAge: 90000, // Items added to this cache expire after 15 minutes
deleteOnExpire: 'passive' // Items will be passively deleted when requested after expiration
});
Do nothing with expired items (not in 1.x.x).
$angularCacheFactory('myNewCache', {
maxAge: 90000, // Items added to this cache expire after 15 minutes
deleteOnExpire: 'none' // Items will expire but not be removed
});
$angularCacheFactory('myNewCache', {
storageMode: 'localStorage',
localStorageImpl: myLocalStoragePolyfill // Use custom localStorage implementation
});
$angularCacheFactory('myNewCache2', {
storageMode: 'sessionStorage',
sessionStorageImpl: mySessionStoragePolyfill // Use custom sessionStorage implementation
});
$angularCacheFactory('myNewCache', {
storageMode: 'localStorage',
storageImpl: myLocalStoragePolyfill // Use custom localStorage implementation
});
$angularCacheFactory('myNewCache2', {
storageMode: 'sessionStorage',
storageImpl: mySessionStoragePolyfill // Use custom sessionStorage implementation
});
The Bower package now contains only dist/angular-cache.js
and dist/angular-cache.min.js`.
cache.get('someKey', function (key, value) {
// do something with expired item
});
cache.get('someKey', {
onExpire: function (key, value) {
// do something with expired item
}
});