diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bdbebd..a5d725c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +##### 3.1.0 15 July 2014 + +###### Backwards compatible API changes +- #117 - call to DSCacheFactory(...) produces JSHint warning (Added DSCacheFactory.createCache method) + +###### Backwards compatible bug fixes +- #118 - dist/angular-cache.js doesn't end with a semicolon (Upgraded dependencies) +- #120 - How come the non minified version has minified code? (Upgraded dependencies) + ##### 3.0.3 16 June 2014 ###### Backwards compatible bug fixes diff --git a/Gruntfile.js b/Gruntfile.js index 0a42ff9..532b423 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -33,11 +33,12 @@ module.exports = function (grunt) { options: { report: 'min', sourceMap: true, + sourceMapName: 'dist/angular-cache.min.map', banner: '/**\n' + '* @author Jason Dobry \n' + '* @file angular-cache.min.js\n' + '* @version <%= pkg.version %> - Homepage \n' + - '* @copyright (c) 2013 Jason Dobry \n' + + '* @copyright (c) 2013-2014 Jason Dobry \n' + '* @license MIT \n' + '*\n' + '* @overview angular-cache is a very useful replacement for Angular\'s $cacheFactory.\n' + diff --git a/README.md b/README.md index d6c782f..bead111 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## angular-cache __A very useful replacement for Angular's $cacheFactory.__ -__Version:__ 3.0.3 +__Version:__ 3.1.0 Documentation for 3.x.x can be found at [angular-data.pseudobry.com](http://angular-data.pseudobry.com). diff --git a/bower.json b/bower.json index e647e3f..086540f 100644 --- a/bower.json +++ b/bower.json @@ -2,7 +2,7 @@ "author": "Jason Dobry", "name": "angular-cache", "description": "angular-cache is a very useful replacement for Angular's $cacheFactory.", - "version": "3.0.3", + "version": "3.1.0", "homepage": "https://github.com/jmdobry/angular-cache", "repository": { "type": "git", diff --git a/dist/angular-cache.js b/dist/angular-cache.js index 5838ddf..86191bb 100644 --- a/dist/angular-cache.js +++ b/dist/angular-cache.js @@ -1,8 +1,8 @@ /** * @author Jason Dobry * @file angular-cache.js - * @version 3.0.3 - Homepage - * @copyright (c) 2013 Jason Dobry + * @version 3.1.0 - Homepage + * @copyright (c) 2013-2014 Jason Dobry * @license MIT * * @overview angular-cache is a very useful replacement for Angular's $cacheFactory. @@ -852,7 +852,7 @@ DSCache.prototype.touch = function (key) { module.exports = DSCache; -},{"../DSBinaryHeap":1,"../defaults":"XjryW+","./destroy":2,"./get":3,"./info":5,"./keySet":6,"./keys":7,"./put":8,"./remove":9,"./removeAll":10,"./removeExpired":11,"./setCacheFlushInterval":12,"./setCapacity":13,"./setDeleteOnExpire":14,"./setMaxAge":15,"./setOnExpire":16,"./setRecycleFreq":17}],5:[function(require,module,exports){ +},{"../DSBinaryHeap":1,"../defaults":"kH9dpy","./destroy":2,"./get":3,"./info":5,"./keySet":6,"./keys":7,"./put":8,"./remove":9,"./removeAll":10,"./removeExpired":11,"./setCacheFlushInterval":12,"./setCapacity":13,"./setDeleteOnExpire":14,"./setMaxAge":15,"./setOnExpire":16,"./setRecycleFreq":17}],5:[function(require,module,exports){ /** * @doc method * @id DSCache.methods:info @@ -1717,7 +1717,7 @@ module.exports = function setRecycleFreq(recycleFreq) { },{}],18:[function(require,module,exports){ var defaults = require('../defaults'), DSCache = require('../DSCache'), - version = '3.0.3'; + version = '3.1.0'; /** * @doc function @@ -1773,6 +1773,21 @@ function DSCacheFactoryProvider() { return keys; } + function createCache(cacheId, options) { + if (cacheId in caches) { + throw angular.$$minErr('$cacheFactory')('iid', "CacheId '{0}' is already taken!", cacheId); + } else if (!angular.isString(cacheId)) { + throw angular.$$minErr('ng')('areq', 'Expected cacheId to be a string! Found: {0}.', typeof cacheId); + } + + caches[cacheId] = new DSCache(cacheId, angular.extend({}, config, options)); + caches[cacheId].destroy = function () { + this.constructor.prototype.destroy.call(this); + delete caches[this.$$id]; + }; + return caches[cacheId]; + } + /** * @doc function * @id DSCacheFactory @@ -1798,20 +1813,35 @@ function DSCacheFactoryProvider() { * @returns {DSCache} New instance of DSCache. */ function DSCacheFactory(cacheId, options) { - if (cacheId in caches) { - throw angular.$$minErr('$cacheFactory')('iid', "CacheId '{0}' is already taken!", cacheId); - } else if (!angular.isString(cacheId)) { - throw angular.$$minErr('ng')('areq', 'Expected cacheId to be a string! Found: {0}.', typeof cacheId); - } - - caches[cacheId] = new DSCache(cacheId, angular.extend({}, config, options)); - caches[cacheId].destroy = function () { - this.constructor.prototype.destroy.call(this); - delete caches[this.$$id]; - }; - return caches[cacheId]; + return createCache(cacheId, options); } + /** + * @doc method + * @id DSCacheFactory.methods:createCache + * @name createCache + * @description + * Factory function that produces instances of `DSCache`. + * + * @param {string} cacheId The id of the new cache. + * @param {object} options Configuration options. Properties: + * + * - `{number=}` - `capacity` - Default: `Number.MAX_VALUE` + * - `{number=}` - `maxAge` - Default: `null` + * - `{number=}` - `deleteOnExpire` - Default: `none` + * - `{function=}` - `onExpire` - Default: `null` + * - `{number=}` - `cacheFlushInterval` - Default: `null` + * - `{number=}` - `recycleFreq` - Default: `1000` + * - `{number=}` - `deleteOnExpire` - Default: `null` + * - `{string=}` - `storageMode` - Default: `'none` + * - `{object=}` - `storageImpl` - Default: `null` + * - `{boolean=}` - `disabled` - Default: `false` + * - `{string=}` - `storagePrefix` - Default: `"angular-cache.caches."` + * + * @returns {DSCache} New instance of DSCache. + */ + DSCacheFactory.createCache = createCache; + DSCacheFactory.version = version; /** @@ -2039,9 +2069,9 @@ function DSCacheFactoryProvider() { module.exports = DSCacheFactoryProvider; -},{"../DSCache":4,"../defaults":"XjryW+"}],"Defaults":[function(require,module,exports){ -module.exports=require('XjryW+'); -},{}],"XjryW+":[function(require,module,exports){ +},{"../DSCache":4,"../defaults":"kH9dpy"}],"Defaults":[function(require,module,exports){ +module.exports=require('kH9dpy'); +},{}],"kH9dpy":[function(require,module,exports){ var defaults = { /** * @doc overview @@ -2335,7 +2365,7 @@ module.exports = { * @id angular-cache * @name Overview * @description - * __Version:__ 3.0.3 + * __Version:__ 3.1.0 * * ## Install * @@ -2355,7 +2385,7 @@ module.exports = { * also consumable by Browserify and you should be able to `require('angular-cache')`. The `main` file is `src/index.js`. * * #### Manual download - * Download angular-cache.3.0.3.js from the [Releases](https://github.com/jmdobry/angular-cache/releases) + * Download angular-cache.3.1.0.js from the [Releases](https://github.com/jmdobry/angular-cache/releases) * section of the angular-cache GitHub project. * * ## Load into Angular @@ -2418,4 +2448,4 @@ module.exports = { } }; -},{}]},{},[21]) +},{}]},{},[21]); diff --git a/dist/angular-cache.min.js b/dist/angular-cache.min.js index 2c951dc..dc760fc 100644 --- a/dist/angular-cache.min.js +++ b/dist/angular-cache.min.js @@ -1,11 +1,11 @@ /** * @author Jason Dobry * @file angular-cache.min.js -* @version 3.0.3 - Homepage -* @copyright (c) 2013 Jason Dobry +* @version 3.1.0 - Homepage +* @copyright (c) 2013-2014 Jason Dobry * @license MIT * * @overview angular-cache is a very useful replacement for Angular's $cacheFactory. */ -require=function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0;){var f=Math.floor((c+1)/2)-1,g=a[f];if(e>=b(g))break;a[f]=d,a[c]=g,c=f}}function d(a,b,c){for(var d=a.length,e=a[c],f=b(e);;){var g=2*(c+1),h=g-1,i=null;if(d>h){var j=a[h],k=b(j);f>k&&(i=h)}if(d>g){var l=a[g],m=b(l);m<(null===i?f:b(a[h]))&&(i=g)}if(null===i)break;a[c]=a[i],a[i]=e,c=i}}function e(a){if(a&&!angular.isFunction(a))throw new Error("DSBinaryHeap(weightFunc): weightFunc: must be a function!");a=a||function(a){return a},this.weightFunc=a,this.heap=[]}function f(){this.$get=function(){return e}}e.prototype.push=function(a){this.heap.push(a),c(this.heap,this.weightFunc,this.heap.length-1)},e.prototype.peek=function(){return this.heap[0]},e.prototype.pop=function(){var a=this.heap[0],b=this.heap.pop();return this.heap.length>0&&(this.heap[0]=b,d(this.heap,this.weightFunc,0)),a},e.prototype.remove=function(a){for(var b=this.heap.length,e=0;b>e;e++)if(angular.equals(this.heap[e],a)){var f=this.heap[e],g=this.heap.pop();return e!==b-1&&(this.heap[e]=g,c(this.heap,this.weightFunc,e),d(this.heap,this.weightFunc,e)),f}return null},e.prototype.removeAll=function(){this.heap=[]},e.prototype.size=function(){return this.heap.length},b.exports={DSBinaryHeapProvider:f,DSBinaryHeap:e}},{}],2:[function(a,b){b.exports=function(){clearInterval(this.$$cacheFlushIntervalId),clearInterval(this.$$recycleFreqId),this.removeAll(),this.$$storage&&(this.$$storage.removeItem(this.$$prefix+".keys"),this.$$storage.removeItem(this.$$prefix)),this.$$storage=null,this.$$data=null,this.$$lruHeap=null,this.$$expiresHeap=null,this.$$prefix=null}},{}],3:[function(a,b){var c=a("../utils");b.exports=function(a,b){var d=this;if(angular.isArray(a)){var e=a,f=[];return angular.forEach(e,function(a){var c=d.get(a,b);null!==c&&void 0!==c&&f.push(c)}),f}if(a=c.stringifyNumber(a),!this.$$disabled){if(b=b||{},!angular.isString(a))throw angular.$$minErr("ng")("areq","Expected key to be a string! Found: {0}.",typeof a);if(b&&!angular.isObject(b))throw angular.$$minErr("ng")("areq","Expected options to be an object! Found: {0}.",typeof b);if(b.onExpire&&!angular.isFunction(b.onExpire))throw angular.$$minErr("ng")("areq","Expected options.onExpire to be a function! Found: {0}.",typeof b.onExpire);var g;if(this.$$storage){var h=this.$$storage.getItem(this.$$prefix+".data."+a);if(!h)return;g=angular.fromJson(h)}else{if(!(a in this.$$data))return;g=this.$$data[a]}var i=g.value,j=(new Date).getTime();return this.$$storage?(this.$$lruHeap.remove({key:a,accessed:g.accessed}),g.accessed=j,this.$$lruHeap.push({key:a,accessed:j})):(this.$$lruHeap.remove(g),g.accessed=j,this.$$lruHeap.push(g)),"passive"===this.$$deleteOnExpire&&"expires"in g&&g.expiresthis.$$maxAge}}return void 0}return{id:this.$$id,capacity:this.$$capacity,maxAge:this.$$maxAge,deleteOnExpire:this.$$deleteOnExpire,onExpire:this.$$onExpire,cacheFlushInterval:this.$$cacheFlushInterval,recycleFreq:this.$$recycleFreq,storageMode:this.$$storageMode,storageImpl:this.$$storage,disabled:this.$$disabled,size:this.$$lruHeap&&this.$$lruHeap.size()||0}}},{}],6:[function(a,b){var c=a("../utils");b.exports=function(){if(this.$$storage){var a=this.$$storage.getItem(this.$$prefix+".keys"),b={};if(a)for(var d=angular.fromJson(a),e=0;ethis.$$capacity&&this.remove(this.$$lruHeap.peek().key),b}}},{"../utils":22}],9:[function(a,b){b.exports=function(a){if(!this.$$storage){var b=this.$$data[a]?this.$$data[a].value:void 0;return this.$$lruHeap.remove(this.$$data[a]),this.$$expiresHeap.remove(this.$$data[a]),this.$$data[a]=null,delete this.$$data[a],b}var c=this.$$storage.getItem(this.$$prefix+".data."+a);if(c){var d=angular.fromJson(c);this.$$lruHeap.remove({key:a,accessed:d.accessed}),this.$$expiresHeap.remove({key:a,expires:d.expires}),this.$$storage.removeItem(this.$$prefix+".data."+a);var e=this.$$storage.getItem(this.$$prefix+".keys"),f=e?angular.fromJson(e):[],g=f.indexOf(a);return g>=0&&f.splice(g,1),this.$$storage.setItem(this.$$prefix+".keys",angular.toJson(f)),d.value}}},{}],10:[function(a,b){b.exports=function(){if(this.$$storage){this.$$lruHeap.removeAll(),this.$$expiresHeap.removeAll();var a=this.$$storage.getItem(this.$$prefix+".keys");if(a)for(var b=angular.fromJson(a),c=0;ca)throw angular.$$minErr("ng")("areq","Expected cacheFlushInterval to be greater than zero! Found: {0}.",a);a!==this.$$cacheFlushInterval&&(this.$$cacheFlushInterval=a,clearInterval(this.$$cacheFlushIntervalId),function(a){a.$$cacheFlushIntervalId=setInterval(function(){a.removeAll()},a.$$cacheFlushInterval)}(this))}}},{}],13:[function(a,b){b.exports=function(a){if(null===a)delete this.$$capacity;else{if(!angular.isNumber(a))throw angular.$$minErr("ng")("areq","Expected capacity to be a number! Found: {0}.",typeof a);if(0>a)throw angular.$$minErr("ng")("areq","Expected capacity to be greater than zero! Found: {0}.",a);this.$$capacity=a}for(var b={};this.$$lruHeap.size()>this.$$capacity;)b[this.$$lruHeap.peek().key]=this.remove(this.$$lruHeap.peek().key);return b}},{}],14:[function(a,b){b.exports=function(a){if(null===a)delete this.$$deleteOnExpire;else{if(!angular.isString(a))throw angular.$$minErr("ng")("areq","Expected deleteOnExpire to be a string! Found: {0}.",typeof a);if("none"!==a&&"passive"!==a&&"aggressive"!==a)throw angular.$$minErr("ng")("areq",'Expected deleteOnExpire to be "none", "passive" or "aggressive"! Found: {0}.',a);this.$$deleteOnExpire=a}this.setRecycleFreq(this.$$recycleFreq)}},{}],15:[function(a,b){var c=a("../utils");b.exports=function(a){if(null===a)delete this.$$maxAge;else{if(!angular.isNumber(a))throw angular.$$minErr("ng")("areq","Expected maxAge to be a number! Found: {0}.",typeof a);if(0>a)throw angular.$$minErr("ng")("areq","Expected maxAge to be greater than zero! Found: {0}.",a);this.$$maxAge=a}var b,d,e;if(this.$$expiresHeap.removeAll(),this.$$storage){var f=this.$$storage.getItem(this.$$prefix+".keys");for(d=f?angular.fromJson(f):[],b=0;ba)throw angular.$$minErr("ng")("areq","Expected recycleFreq to be greater than zero! Found: {0}.",a);this.$$recycleFreq=a}clearInterval(this.$$recycleFreqId),"aggressive"===this.$$deleteOnExpire?!function(a){a.$$recycleFreqId=setInterval(function(){a.removeExpired()},a.$$recycleFreq)}(this):delete this.$$recycleFreqId}},{}],18:[function(a,b){function c(){var a=new d.Config;this.version=f,this.setCacheDefaults=function(b){if(b=b||{},!angular.isObject(b))throw angular.$$minErr("ng")("areq","Expected options to be an object! Found: {0}.",typeof b);for(var c in d.defaults)c in b&&(a[c]=b[c]);"disabled"in b&&(a.$$disabled=!!b.disabled)},this.$get=function(){function b(a){var b,c=[];for(b in a)a.hasOwnProperty(b)&&c.push(b);return c}function c(b,c){if(b in g)throw angular.$$minErr("$cacheFactory")("iid","CacheId '{0}' is already taken!",b);if(!angular.isString(b))throw angular.$$minErr("ng")("areq","Expected cacheId to be a string! Found: {0}.",typeof b);return g[b]=new e(b,angular.extend({},a,c)),g[b].destroy=function(){this.constructor.prototype.destroy.call(this),delete g[this.$$id]},g[b]}var g={};return c.version=f,c.info=function(){for(var c=b(g),e={size:c.length,caches:{}},f=0;f0;){var f=Math.floor((c+1)/2)-1,g=a[f];if(e>=b(g))break;a[f]=d,a[c]=g,c=f}}function d(a,b,c){for(var d=a.length,e=a[c],f=b(e);;){var g=2*(c+1),h=g-1,i=null;if(d>h){var j=a[h],k=b(j);f>k&&(i=h)}if(d>g){var l=a[g],m=b(l);m<(null===i?f:b(a[h]))&&(i=g)}if(null===i)break;a[c]=a[i],a[i]=e,c=i}}function e(a){if(a&&!angular.isFunction(a))throw new Error("DSBinaryHeap(weightFunc): weightFunc: must be a function!");a=a||function(a){return a},this.weightFunc=a,this.heap=[]}function f(){this.$get=function(){return e}}e.prototype.push=function(a){this.heap.push(a),c(this.heap,this.weightFunc,this.heap.length-1)},e.prototype.peek=function(){return this.heap[0]},e.prototype.pop=function(){var a=this.heap[0],b=this.heap.pop();return this.heap.length>0&&(this.heap[0]=b,d(this.heap,this.weightFunc,0)),a},e.prototype.remove=function(a){for(var b=this.heap.length,e=0;b>e;e++)if(angular.equals(this.heap[e],a)){var f=this.heap[e],g=this.heap.pop();return e!==b-1&&(this.heap[e]=g,c(this.heap,this.weightFunc,e),d(this.heap,this.weightFunc,e)),f}return null},e.prototype.removeAll=function(){this.heap=[]},e.prototype.size=function(){return this.heap.length},b.exports={DSBinaryHeapProvider:f,DSBinaryHeap:e}},{}],2:[function(a,b){b.exports=function(){clearInterval(this.$$cacheFlushIntervalId),clearInterval(this.$$recycleFreqId),this.removeAll(),this.$$storage&&(this.$$storage.removeItem(this.$$prefix+".keys"),this.$$storage.removeItem(this.$$prefix)),this.$$storage=null,this.$$data=null,this.$$lruHeap=null,this.$$expiresHeap=null,this.$$prefix=null}},{}],3:[function(a,b){var c=a("../utils");b.exports=function(a,b){var d=this;if(angular.isArray(a)){var e=a,f=[];return angular.forEach(e,function(a){var c=d.get(a,b);null!==c&&void 0!==c&&f.push(c)}),f}if(a=c.stringifyNumber(a),!this.$$disabled){if(b=b||{},!angular.isString(a))throw angular.$$minErr("ng")("areq","Expected key to be a string! Found: {0}.",typeof a);if(b&&!angular.isObject(b))throw angular.$$minErr("ng")("areq","Expected options to be an object! Found: {0}.",typeof b);if(b.onExpire&&!angular.isFunction(b.onExpire))throw angular.$$minErr("ng")("areq","Expected options.onExpire to be a function! Found: {0}.",typeof b.onExpire);var g;if(this.$$storage){var h=this.$$storage.getItem(this.$$prefix+".data."+a);if(!h)return;g=angular.fromJson(h)}else{if(!(a in this.$$data))return;g=this.$$data[a]}var i=g.value,j=(new Date).getTime();return this.$$storage?(this.$$lruHeap.remove({key:a,accessed:g.accessed}),g.accessed=j,this.$$lruHeap.push({key:a,accessed:j})):(this.$$lruHeap.remove(g),g.accessed=j,this.$$lruHeap.push(g)),"passive"===this.$$deleteOnExpire&&"expires"in g&&g.expiresthis.$$maxAge}}return void 0}return{id:this.$$id,capacity:this.$$capacity,maxAge:this.$$maxAge,deleteOnExpire:this.$$deleteOnExpire,onExpire:this.$$onExpire,cacheFlushInterval:this.$$cacheFlushInterval,recycleFreq:this.$$recycleFreq,storageMode:this.$$storageMode,storageImpl:this.$$storage,disabled:this.$$disabled,size:this.$$lruHeap&&this.$$lruHeap.size()||0}}},{}],6:[function(a,b){var c=a("../utils");b.exports=function(){if(this.$$storage){var a=this.$$storage.getItem(this.$$prefix+".keys"),b={};if(a)for(var d=angular.fromJson(a),e=0;ethis.$$capacity&&this.remove(this.$$lruHeap.peek().key),b}}},{"../utils":22}],9:[function(a,b){b.exports=function(a){if(!this.$$storage){var b=this.$$data[a]?this.$$data[a].value:void 0;return this.$$lruHeap.remove(this.$$data[a]),this.$$expiresHeap.remove(this.$$data[a]),this.$$data[a]=null,delete this.$$data[a],b}var c=this.$$storage.getItem(this.$$prefix+".data."+a);if(c){var d=angular.fromJson(c);this.$$lruHeap.remove({key:a,accessed:d.accessed}),this.$$expiresHeap.remove({key:a,expires:d.expires}),this.$$storage.removeItem(this.$$prefix+".data."+a);var e=this.$$storage.getItem(this.$$prefix+".keys"),f=e?angular.fromJson(e):[],g=f.indexOf(a);return g>=0&&f.splice(g,1),this.$$storage.setItem(this.$$prefix+".keys",angular.toJson(f)),d.value}}},{}],10:[function(a,b){b.exports=function(){if(this.$$storage){this.$$lruHeap.removeAll(),this.$$expiresHeap.removeAll();var a=this.$$storage.getItem(this.$$prefix+".keys");if(a)for(var b=angular.fromJson(a),c=0;ca)throw angular.$$minErr("ng")("areq","Expected cacheFlushInterval to be greater than zero! Found: {0}.",a);a!==this.$$cacheFlushInterval&&(this.$$cacheFlushInterval=a,clearInterval(this.$$cacheFlushIntervalId),function(a){a.$$cacheFlushIntervalId=setInterval(function(){a.removeAll()},a.$$cacheFlushInterval)}(this))}}},{}],13:[function(a,b){b.exports=function(a){if(null===a)delete this.$$capacity;else{if(!angular.isNumber(a))throw angular.$$minErr("ng")("areq","Expected capacity to be a number! Found: {0}.",typeof a);if(0>a)throw angular.$$minErr("ng")("areq","Expected capacity to be greater than zero! Found: {0}.",a);this.$$capacity=a}for(var b={};this.$$lruHeap.size()>this.$$capacity;)b[this.$$lruHeap.peek().key]=this.remove(this.$$lruHeap.peek().key);return b}},{}],14:[function(a,b){b.exports=function(a){if(null===a)delete this.$$deleteOnExpire;else{if(!angular.isString(a))throw angular.$$minErr("ng")("areq","Expected deleteOnExpire to be a string! Found: {0}.",typeof a);if("none"!==a&&"passive"!==a&&"aggressive"!==a)throw angular.$$minErr("ng")("areq",'Expected deleteOnExpire to be "none", "passive" or "aggressive"! Found: {0}.',a);this.$$deleteOnExpire=a}this.setRecycleFreq(this.$$recycleFreq)}},{}],15:[function(a,b){var c=a("../utils");b.exports=function(a){if(null===a)delete this.$$maxAge;else{if(!angular.isNumber(a))throw angular.$$minErr("ng")("areq","Expected maxAge to be a number! Found: {0}.",typeof a);if(0>a)throw angular.$$minErr("ng")("areq","Expected maxAge to be greater than zero! Found: {0}.",a);this.$$maxAge=a}var b,d,e;if(this.$$expiresHeap.removeAll(),this.$$storage){var f=this.$$storage.getItem(this.$$prefix+".keys");for(d=f?angular.fromJson(f):[],b=0;ba)throw angular.$$minErr("ng")("areq","Expected recycleFreq to be greater than zero! Found: {0}.",a);this.$$recycleFreq=a}clearInterval(this.$$recycleFreqId),"aggressive"===this.$$deleteOnExpire?!function(a){a.$$recycleFreqId=setInterval(function(){a.removeExpired()},a.$$recycleFreq)}(this):delete this.$$recycleFreqId}},{}],18:[function(a,b){function c(){var a=new d.Config;this.version=f,this.setCacheDefaults=function(b){if(b=b||{},!angular.isObject(b))throw angular.$$minErr("ng")("areq","Expected options to be an object! Found: {0}.",typeof b);for(var c in d.defaults)c in b&&(a[c]=b[c]);"disabled"in b&&(a.$$disabled=!!b.disabled)},this.$get=function(){function b(a){var b,c=[];for(b in a)a.hasOwnProperty(b)&&c.push(b);return c}function c(b,c){if(b in h)throw angular.$$minErr("$cacheFactory")("iid","CacheId '{0}' is already taken!",b);if(!angular.isString(b))throw angular.$$minErr("ng")("areq","Expected cacheId to be a string! Found: {0}.",typeof b);return h[b]=new e(b,angular.extend({},a,c)),h[b].destroy=function(){this.constructor.prototype.destroy.call(this),delete h[this.$$id]},h[b]}function g(a,b){return c(a,b)}var h={};return g.createCache=c,g.version=f,g.info=function(){for(var c=b(h),e={size:c.length,caches:{}},f=0;f