fix(core): remove cache onExpire event, because work not fine

This commit is contained in:
OldHawk
2018-05-05 01:26:48 +08:00
parent a6bbd7942b
commit 5a060ea819
2 changed files with 2 additions and 12 deletions

View File

@@ -169,13 +169,11 @@ module.exports = {
* @maxAge: The number of milliseconds until a newly inserted item expires
* @recycleFreq: Determines how often a cache will scan for expired items
* @storageMode: Determines the storage medium used by a cache, value of 'memory', 'localStorage' and 'sessionStorage'
* @refreshOnExpire: refresh data on expire
*/
cache: {
maxAge: 60 * 1000 * 1,
recycleFreq: 60 * 1000,
storageMode: 'memory',
refreshOnExpire: true
storageMode: 'localStorage'
},
/**

View File

@@ -195,15 +195,7 @@
maxAge: cacheConfig.maxAge,
recycleFreq: cacheConfig.recycleFreq,
deleteOnExpire: 'aggressive',
storageMode: cacheConfig.storageMode,
onExpire: function (key, value) {
if (cacheConfig.refreshOnExpire) {
var _this = this; // "this" is the cache in which the item expired
angular.injector(['ng']).get('$http').get(key).success(function (data) {
_this.put(key, data);
});
}
}
storageMode: cacheConfig.storageMode
});
}