diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d559a8..a1141b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +##### 1.1.0 - 03 September 2013 + +###### Backwards compatible API changes +- Added `onExpire` callback hook #27 +- Added `$angularCacheFactory.removeAll()` and `$angularCacheFactory.clearAll()` convenience methods #37, #38 + ##### 1.0.0 - 25 August 2013 - Closed #31 (Improved documentation) - Closed #32 diff --git a/README.md b/README.md index fe84075..fe42584 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -angular-cache (1.0.1-SNAPSHOT) +angular-cache (1.1.0) ===================== angular-cache is a caching system that improves upon the capabilities of the $cacheFactory provided by AngularJS. Check out the [demo](http://jmdobry.github.io/angular-cache/demo/) for a quick introduction, or continue on down for more detailed information. @@ -233,9 +233,9 @@ $angularCacheFactory.get('someCache').setOptions({ capacity: 4500 }); ## Status | Version | Branch | Build status | Test Coverage | | ------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | -| 1.0.1-SNAPSHOT | [master](https://github.com/jmdobry/angular-cache) | [![Build Status](https://travis-ci.org/jmdobry/angular-cache.png?branch=master)](https://travis-ci.org/jmdobry/angular-cache) | [Test Coverage](http://jmdobry.github.io/angular-cache/coverage/) | -| 1.0.1-SNAPSHOT | [develop](https://github.com/jmdobry/angular-cache/tree/develop) | [![Build Status](https://travis-ci.org/jmdobry/angular-cache.png?branch=develop)](https://travis-ci.org/jmdobry/angular-cache) | | -| 1.0.1-SNAPSHOT | [all](https://drone.io/github.com/jmdobry/angular-cache) | [![Build Status](https://drone.io/github.com/jmdobry/angular-cache/status.png)](https://drone.io/github.com/jmdobry/angular-cache/latest) +| 1.1.0 | [master](https://github.com/jmdobry/angular-cache) | [![Build Status](https://travis-ci.org/jmdobry/angular-cache.png?branch=master)](https://travis-ci.org/jmdobry/angular-cache) | [Test Coverage](http://jmdobry.github.io/angular-cache/coverage/) | +| 1.1.0 | [develop](https://github.com/jmdobry/angular-cache/tree/develop) | [![Build Status](https://travis-ci.org/jmdobry/angular-cache.png?branch=develop)](https://travis-ci.org/jmdobry/angular-cache) | | +| 1.1.0 | [all](https://drone.io/github.com/jmdobry/angular-cache) | [![Build Status](https://drone.io/github.com/jmdobry/angular-cache/status.png)](https://drone.io/github.com/jmdobry/angular-cache/latest) ## Download @@ -243,8 +243,8 @@ $angularCacheFactory.get('someCache').setOptions({ capacity: 4500 }); #### Latest Stable Version | Type | File | Size | | ------------- | ----------------- | ------------------- | ---- | -| Production | [angular-cache-1.0.1-SNAPSHOT.min.js](https://raw.github.com/jmdobry/angular-cache/master/dist/angular-cache-1.0.1-SNAPSHOT.min.js) | 6 KB | -| Development | [angular-cache-1.0.1-SNAPSHOT.js](https://raw.github.com/jmdobry/angular-cache/master/dist/angular-cache-1.0.1-SNAPSHOT.js) | 34 KB | +| Production | [angular-cache-1.1.0.min.js](https://raw.github.com/jmdobry/angular-cache/master/dist/angular-cache-1.1.0.min.js) | 6 KB | +| Development | [angular-cache-1.1.0.js](https://raw.github.com/jmdobry/angular-cache/master/dist/angular-cache-1.1.0.js) | 34 KB | ## Installation @@ -696,6 +696,12 @@ See [AngularCache#info](http://jmdobry.github.io/angular-cache/docs/Cache.html#i ## Changelog +##### 1.1.0 - 03 September 2013 + +###### Backwards compatible API changes +- Added onExpire callback hook #27 +- Added `$angularCacheFactory.removeAll()` and `$angularCacheFactory.clearAll()` convenience methods #37, #38 + ##### 1.0.0 - 26 August 2013 - Closed #31 (Improved documentation) - Closed #32 diff --git a/bower.json b/bower.json index efd4aab..ca8c520 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": "1.1.0-SNAPSHOT", + "version": "1.1.0", "homepage": "http://jmdobry.github.io/angular-cache/", "repository": { "type": "git", diff --git a/coverage/index.html b/coverage/index.html index a6d21d7..cf12d5e 100644 --- a/coverage/index.html +++ b/coverage/index.html @@ -183,16 +183,16 @@

Code coverage report for All files

- Statements: 95.96% (309 / 322)      + Statements: 96.06% (317 / 330)      Branches: 91.02% (223 / 245)      - Functions: 100% (42 / 42)      + Functions: 100% (44 / 44)      - Lines: 95.96% (309 / 322)      + Lines: 96.06% (317 / 330)     

@@ -215,16 +215,16 @@

- ./src\ - - 95.96% - (309 / 322) + src/ + + 96.06% + (317 / 330) 91.02% (223 / 245) 100% - (42 / 42) - 95.96% - (309 / 322) + (44 / 44) + 96.06% + (317 / 330) @@ -232,7 +232,7 @@

diff --git a/coverage/src/angular-cache.js.html b/coverage/src/angular-cache.js.html index eebbfdd..98a189a 100644 --- a/coverage/src/angular-cache.js.html +++ b/coverage/src/angular-cache.js.html @@ -1,7 +1,7 @@ - Code coverage report for ./src/angular-cache.js + Code coverage report for src/angular-cache.js @@ -180,22 +180,22 @@
-

Code coverage report for ./src/angular-cache.js

+

Code coverage report for src/angular-cache.js

- Statements: 95.96% (309 / 322)      + Statements: 96.06% (317 / 330)      Branches: 91.02% (223 / 245)      - Functions: 100% (42 / 42)      + Functions: 100% (44 / 44)      - Lines: 95.96% (309 / 322)      + Lines: 96.06% (317 / 330)     

-
All files » ./src\ » angular-cache.js
+
All files » src/ » angular-cache.js

@@ -1006,7 +1006,31 @@ 

805 806 807 -808

- - - + + + - - - + + + @@ -232,7 +232,7 @@

diff --git a/dist/angular-cache-1.1.0-SNAPSHOT.js b/dist/angular-cache-1.1.0.js similarity index 97% rename from dist/angular-cache-1.1.0-SNAPSHOT.js rename to dist/angular-cache-1.1.0.js index 51e8b4f..bf48f12 100644 --- a/dist/angular-cache-1.1.0-SNAPSHOT.js +++ b/dist/angular-cache-1.1.0.js @@ -1,7 +1,7 @@ /** * @author Jason Dobry - * @file angular-cache-1.1.0-SNAPSHOT.js - * @version 1.1.0-SNAPSHOT - [Homepage]{@link http://jmdobry.github.io/angular-cache/} + * @file angular-cache-1.1.0.js + * @version 1.1.0 - [Homepage]{@link http://jmdobry.github.io/angular-cache/} * @copyright (c) 2013 Jason Dobry * @license MIT * @@ -798,6 +798,30 @@ return _keys(caches); }; + /** + * @method angularCacheFactory.removeAll + * @desc Remove all caches owned by this $angularCacheFactory. + * @public + */ + angularCacheFactory.removeAll = function () { + var keys = _keys(caches); + for (var i = 0; i < keys.length; i++) { + caches[keys[i]].destroy(); + } + }; + + /** + * @method angularCacheFactory.clearAll + * @desc Clears the contents of every cache owned by this $angularCacheFactory. + * @public + */ + angularCacheFactory.clearAll = function () { + var keys = _keys(caches); + for (var i = 0; i < keys.length; i++) { + caches[keys[i]].removeAll(); + } + }; + return angularCacheFactory; }]; } diff --git a/dist/angular-cache-1.1.0-SNAPSHOT.min.js b/dist/angular-cache-1.1.0.min.js similarity index 94% rename from dist/angular-cache-1.1.0-SNAPSHOT.min.js rename to dist/angular-cache-1.1.0.min.js index 1007493..5935495 100644 --- a/dist/angular-cache-1.1.0-SNAPSHOT.min.js +++ b/dist/angular-cache-1.1.0.min.js @@ -1 +1 @@ -!function(a,b){"use strict";function c(){this.$get=["$timeout","$window",function(a,c){function d(a){var b,c={};for(b in a)a.hasOwnProperty(b)&&(c[b]=b);return c}function e(a){var b,c=[];for(b in a)a.hasOwnProperty(b)&&c.push(b);return c}function f(f,g){function i(b,c){w[b].timeoutId=a(function(){var a;w[b]&&(a=w[b].value),C.remove(b),v.onExpire&&v.onExpire(b,a)},c)}function j(a,c){b.isNumber(a)?0>a?c("must be greater than zero!",a):c(null,a):c("must be a number!",a)}function k(a,b){a===Number.MAX_VALUE?(v.capacity=a,b(null,v.capacity)):j(a,function(a,c){if(a)b(a,c);else{for(v.capacity=c;u>v.capacity;)C.remove(z.key);b(null,v.capacity)}})}function l(a,b){null===a?(v.aggressiveDelete=!1,b(null,v.aggressiveDelete)):a===!0||a===!1?(v.aggressiveDelete=a,b(null,v.aggressiveDelete)):b("must be a boolean!",a)}function m(b,c){var d=e(w);if(null===b){v.maxAge=b;for(var f=0;f0&&v.aggressiveDelete?i(g,v.maxAge):C.remove(g)}}c(null,v.maxAge)}})}function n(b,c){v.cacheFlushIntervalId&&(clearInterval(v.cacheFlushIntervalId),delete v.cacheFlushIntervalId),null===b?(v.cacheFlushInterval=b,c(null,v.cacheFlushInterval)):j(b,function(b,d){b?c(b,d):(v.cacheFlushInterval=d,v.cacheFlushIntervalId=setInterval(function(){for(var b=e(w),c=0;ce)D.removeItem(A+".data."+a[c]);else{var f={timestamp:d.timestamp};d.maxAge&&(f.maxAge=d.maxAge),d.hasOwnProperty("aggressiveDelete")&&(f.aggressiveDelete=d.aggressiveDelete),C.put(a[c],d.value)}}t()}}function t(){v.storageMode&&D&&D.setItem(A+".keys",b.toJson(e(w)))}var u=0,v=b.extend({},{id:f}),w={},x={},y=null,z=null,A="angular-cache.caches."+f,B=!1,C=this,D=null;g=g||{},g.hasOwnProperty("aggressiveDelete")||(g.aggressiveDelete=!1),this.put=function(c,d,e){var f=x[c]||(x[c]={key:c});if(!b.isString(c))throw new Error("The key must be a string!");if(e&&e.maxAge&&j(e.maxAge,function(a){if(a)throw new Error("AngularCache.put(): maxAge: "+a)}),e&&e.hasOwnProperty("aggressiveDelete")&&e.aggressiveDelete!==!0&&e.aggressiveDelete!==!1)throw new Error("AngularCache.put(): aggressiveDelete must be a boolean!");return q(f),b.isUndefined(d)?void 0:(c in w||u++,w[c]={value:d},e&&e.hasOwnProperty("aggressiveDelete")&&(w[c].aggressiveDelete=e.aggressiveDelete),w[c].timestamp=e&&e.timestamp||(new Date).getTime(),(e&&e.maxAge||v.maxAge)&&(w[c].timeoutId&&a.cancel(w[c].timeoutId),(w[c].aggressiveDelete||!w[c].hasOwnProperty("aggressiveDelete")&&v.aggressiveDelete)&&i(c,e&&e.maxAge||v.maxAge)),t(),v.storageMode&&D.setItem(A+".data."+c,b.toJson(w[c])),u>v.capacity&&this.remove(z.key),d)},this.get=function(a,b){var c,d,e,f=x[a];if(f)return c=w[a],d=c.maxAge||v.maxAge,e=c.hasOwnProperty("aggressiveDelete")?c.aggressiveDelete:v.aggressiveDelete,!e&&d&&(new Date).getTime()-c.timestamp>d?(this.remove(a),f=null,v.onExpire?(v.onExpire(a,c.value,b),void 0):b&&"function"==typeof b?(b(a,c.value),void 0):void 0):(q(f),c.value)},this.remove=function(a){var b=x[a];b&&(b===y&&(y=b.p),b===z&&(z=b.n),r(b.n,b.p),delete x[a],delete w[a],t(),v.storageMode&&D.removeItem(A+".data."+a),u--)},this.removeAll=function(){if(v.storageMode)for(var a=e(w),b=0;ba?c("must be greater than zero!",a):c(null,a):c("must be a number!",a)}function k(a,b){a===Number.MAX_VALUE?(v.capacity=a,b(null,v.capacity)):j(a,function(a,c){if(a)b(a,c);else{for(v.capacity=c;u>v.capacity;)C.remove(z.key);b(null,v.capacity)}})}function l(a,b){null===a?(v.aggressiveDelete=!1,b(null,v.aggressiveDelete)):a===!0||a===!1?(v.aggressiveDelete=a,b(null,v.aggressiveDelete)):b("must be a boolean!",a)}function m(b,c){var d=e(w);if(null===b){v.maxAge=b;for(var f=0;f0&&v.aggressiveDelete?i(g,v.maxAge):C.remove(g)}}c(null,v.maxAge)}})}function n(b,c){v.cacheFlushIntervalId&&(clearInterval(v.cacheFlushIntervalId),delete v.cacheFlushIntervalId),null===b?(v.cacheFlushInterval=b,c(null,v.cacheFlushInterval)):j(b,function(b,d){b?c(b,d):(v.cacheFlushInterval=d,v.cacheFlushIntervalId=setInterval(function(){for(var b=e(w),c=0;ce)D.removeItem(A+".data."+a[c]);else{var f={timestamp:d.timestamp};d.maxAge&&(f.maxAge=d.maxAge),d.hasOwnProperty("aggressiveDelete")&&(f.aggressiveDelete=d.aggressiveDelete),C.put(a[c],d.value)}}t()}}function t(){v.storageMode&&D&&D.setItem(A+".keys",b.toJson(e(w)))}var u=0,v=b.extend({},{id:f}),w={},x={},y=null,z=null,A="angular-cache.caches."+f,B=!1,C=this,D=null;g=g||{},g.hasOwnProperty("aggressiveDelete")||(g.aggressiveDelete=!1),this.put=function(c,d,e){var f=x[c]||(x[c]={key:c});if(!b.isString(c))throw new Error("The key must be a string!");if(e&&e.maxAge&&j(e.maxAge,function(a){if(a)throw new Error("AngularCache.put(): maxAge: "+a)}),e&&e.hasOwnProperty("aggressiveDelete")&&e.aggressiveDelete!==!0&&e.aggressiveDelete!==!1)throw new Error("AngularCache.put(): aggressiveDelete must be a boolean!");return q(f),b.isUndefined(d)?void 0:(c in w||u++,w[c]={value:d},e&&e.hasOwnProperty("aggressiveDelete")&&(w[c].aggressiveDelete=e.aggressiveDelete),w[c].timestamp=e&&e.timestamp||(new Date).getTime(),(e&&e.maxAge||v.maxAge)&&(w[c].timeoutId&&a.cancel(w[c].timeoutId),(w[c].aggressiveDelete||!w[c].hasOwnProperty("aggressiveDelete")&&v.aggressiveDelete)&&i(c,e&&e.maxAge||v.maxAge)),t(),v.storageMode&&D.setItem(A+".data."+c,b.toJson(w[c])),u>v.capacity&&this.remove(z.key),d)},this.get=function(a,b){var c,d,e,f=x[a];if(f)return c=w[a],d=c.maxAge||v.maxAge,e=c.hasOwnProperty("aggressiveDelete")?c.aggressiveDelete:v.aggressiveDelete,!e&&d&&(new Date).getTime()-c.timestamp>d?(this.remove(a),f=null,v.onExpire?(v.onExpire(a,c.value,b),void 0):b&&"function"==typeof b?(b(a,c.value),void 0):void 0):(q(f),c.value)},this.remove=function(a){var b=x[a];b&&(b===y&&(y=b.p),b===z&&(z=b.n),r(b.n,b.p),delete x[a],delete w[a],t(),v.storageMode&&D.removeItem(A+".data."+a),u--)},this.removeAll=function(){if(v.storageMode)for(var a=e(w),b=0;b
Source:
@@ -144,7 +144,7 @@

Index

Modules

  • diff --git a/docs/AngularCache.html b/docs/AngularCache.html index edddc4d..9975b50 100644 --- a/docs/AngularCache.html +++ b/docs/AngularCache.html @@ -1,1267 +1,1269 @@ - - - - - JSDoc: Class: AngularCache - - - - - - - - - - -
    - -

    Class: AngularCache

    - - - - - -
    - -
    -

    - AngularCache -

    - -
    - -
    -
    - - - - -
    -

    new AngularCache(cacheId, options)

    - - -
    -
    - - -
    - Instantiated via $angularCacheFactory(cacheId[, options]) -
    - - - - - - - -
    Parameters:
    - - -

  +808 +809 +810 +811 +812 +813 +814 +815 +816 +817 +818 +819 +820 +821 +822 +823 +824 +825 +826 +827 +828 +829 +830 +831 +832        @@ -1038,8 +1062,8 @@

      -50 -50 +52 +52       @@ -1066,13 +1090,13 @@

    1 -170 -170 -77 -77 +178 +178 +83 +83     -170 +178       @@ -1082,7 +1106,7 @@

    1 -71 +77       @@ -1093,10 +1117,10 @@

      -71 +77   -71 -61 +77 +67       @@ -1148,9 +1172,9 @@

    1 -77 -68 -68 +83 +74 +74   9 9 @@ -1175,13 +1199,13 @@

    1 -79 +85 4 4   -75 -75 -75 +81 +81 +81       @@ -1197,17 +1221,17 @@

    1 -79 +85   -79 -53 -53 +85 +59 +59 2 2       -53 +59   26 26 @@ -1243,13 +1267,13 @@

    1 -73 +79 3 3   -73 -63 -63 +79 +69 +69   10 10 @@ -1287,8 +1311,8 @@

    1 -71 -71 +77 +77   3 3 @@ -1298,7 +1322,7 @@

3 3   -68 +74   11 11 @@ -1330,11 +1354,11 @@

  9   -48 -48 +54 +54     -71 +77       @@ -1347,69 +1371,69 @@

    1 -85 +91     -85 -77 -77 +91 +83 +83 2           -83 -79 -79 +89 +85 +85           -83 +89 5       -83 -79 -79 +89 +85 +85 2           -81 -73 -73 +87 +79 +79 2           -79 -71 -71 +85 +77 +77             -79 -69 +85 +75   -79 +85 5     5     -79 +85       @@ -1420,17 +1444,17 @@

    1 -107 -94 -44 +110 +97 +47 50 15     -94 -94 -94 -94 +97 +97 +97 +97       @@ -1443,11 +1467,11 @@

    1 -232 -129 -129 +238 +132 +132   -129 +132 50     @@ -1492,7 +1516,7 @@

    1 -149 +152 59     @@ -1506,45 +1530,45 @@

      -71 -86 +77 +89   -86 +89 3   -83 +86 6 6 2       -81 +84 2         -81 +84   -81 +84 1   -80 -79 +83 +82     -80 +83       -80 +83 2     -80 +83   -80 +83 25     @@ -1553,17 +1577,17 @@

      -80 +83   -80 +83 22     -80 +83 3     -80 +83       @@ -1575,14 +1599,14 @@

      -71 -69 +77 +72         -69 -37 +72 +40     32 @@ -1620,7 +1644,7 @@

      -71 +77 46   46 @@ -1652,21 +1676,21 @@

      -71 -20 +77 +23 19 19 10       -20 -20 -20 -20 -20 +23 +23 +23 +23 +23   -20 +23 19     @@ -1676,22 +1700,22 @@

      -71 -63 -63 +77 +69 +69 17 17 17   -63 -63 -63 -63 -63 -63 -63 -63 -63 +69 +69 +69 +69 +69 +69 +69 +69 +69       @@ -1700,7 +1724,7 @@

      -71 +77 63     @@ -1710,7 +1734,7 @@

      -71 +77 2     @@ -1720,7 +1744,7 @@

      -71 +77 2     @@ -1732,10 +1756,10 @@

      -71 +77     -71 +77       @@ -1745,14 +1769,14 @@

    1 -75 +81 1 -74 +80 3     +77 71 -65       @@ -1761,7 +1785,7 @@

      -50 +52 1 1 1 @@ -1778,8 +1802,8 @@

      -50 -10 +52 +16       @@ -1790,7 +1814,7 @@

      -50 +52 2     @@ -1802,11 +1826,35 @@

      -50 +52 2     -50 +  +  +  +  +  +52 +1 +1 +3 +  +  +  +  +  +  +  +  +52 +1 +1 +3 +  +  +  +52       @@ -2612,6 +2660,30 @@

angularCacheFactory.keys = function () { return _keys(caches); }; +  + /** + * @method angularCacheFactory.removeAll + * @desc Remove all caches owned by this $angularCacheFactory. + * @public + */ + angularCacheFactory.removeAll = function () { + var keys = _keys(caches); + for (var i = 0; i < keys.length; i++) { + caches[keys[i]].destroy(); + } + }; +  + /** + * @method angularCacheFactory.clearAll + * @desc Clears the contents of every cache owned by this $angularCacheFactory. + * @public + */ + angularCacheFactory.clearAll = function () { + var keys = _keys(caches); + for (var i = 0; i < keys.length; i++) { + caches[keys[i]].removeAll(); + } + };   return angularCacheFactory; }]; @@ -2625,7 +2697,7 @@

diff --git a/coverage/src/index.html b/coverage/src/index.html index 785c848..d613e09 100644 --- a/coverage/src/index.html +++ b/coverage/src/index.html @@ -1,7 +1,7 @@ - Code coverage report for ./src\ + Code coverage report for src/ @@ -180,22 +180,22 @@
-

Code coverage report for ./src\

+

Code coverage report for src/

- Statements: 95.96% (309 / 322)      + Statements: 96.06% (317 / 330)      Branches: 91.02% (223 / 245)      - Functions: 100% (42 / 42)      + Functions: 100% (44 / 44)      - Lines: 95.96% (309 / 322)      + Lines: 96.06% (317 / 330)     

-
All files » ./src\
+
All files » src/
@@ -216,15 +216,15 @@

angular-cache.js95.96%(309 / 322)96.06%(317 / 330) 91.02% (223 / 245) 100%(42 / 42)95.96%(309 / 322)(44 / 44)96.06%(317 / 330)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
cacheId - - -String - - - - - - - - - - The id of the new cache.
options - - -Object - - - - - - <optional>
- - - - - -
{{[capacity]: Number, [maxAge]: Number, [cacheFlushInterval]: Number, [aggressiveDelete]: Boolean, [onExpire]: Function, [storageMode]: String, [localStorageImpl]: Object}}
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - -

Methods

- -
- -
-

<static> destroy()

- - -
-
- - -
- Completely destroy this cache. -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
- - - -
-

<static> get(key, onExpire) → {*}

- - -
-
- - -
- Retrieve the item from the cache with the specified key. -
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
key - - -String - - - - - - - - - - The key of the item to retrieve.
onExpire - - -Function - - - - - - <optional>
- - - - - -
Callback to be executed if it is discovered the requested item has expired.
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - -
Returns:
- - -
- The value of the item in the cache with the specified key. -
- - - -
-
- Type -
-
- -* - - -
-
- - - - -
- - - -
-

<static> info() → {Object}

- - -
-
- - -
- Return an object containing information about this cache. -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - -
Returns:
- - -
- stats Object containing information about this cache. -
- - - -
-
- Type -
-
- -Object - - -
-
- - - - -
- - - -
-

<static> keys() → {Array}

- - -
-
- - -
- Return an array of the keys of all items currently in this cache.. -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - -
Returns:
- - -
- An array of the keys of all items currently in this cache.. -
- - - -
-
- Type -
-
- -Array - - -
-
- - - - -
- - - -
-

<static> keySet() → {Object}

- - -
-
- - -
- Return the set of the keys of all items currently in this cache. -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - -
Returns:
- - -
- The set of the keys of all items currently in this cache. -
- - - -
-
- Type -
-
- -Object - - -
-
- - - - -
- - - -
-

<static> put(key, value, options) → {*}

- - -
-
- - -
- Add a key-value pair with timestamp to the cache. -
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeArgumentDescription
key - - -String - - - - - - - - - - The identifier for the item to add to the cache.
value - - -* - - - - - - - - - - The value of the item to add to the cache.
options - - -Object - - - - - - <optional>
- - - - - -
{ maxAge: {Number} }
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - -
Returns:
- - -
- value The value of the item added to the cache. -
- - - -
-
- Type -
-
- -* - - -
-
- - - - -
- - - -
-

<static> remove(key)

- - -
-
- - -
- Remove the specified key-value pair from this cache. -
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
key - - -String - - - - The key of the key-value pair to remove.
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
- - - -
-

<static> removeAll()

- - -
-
- - -
- Clear this cache. -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
- - - -
-

<static> setOptions(options, strict)

- - -
-
- - -
- Configure this cache with the given options. -
- - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
options - - -Object - - - -
strict - - -Boolean - - - - If true then any existing configuration will be reset to defaults before applying the new options, otherwise only the options specified in the hash will be altered.
- - - -
- - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - -
- -
- - - - - - - - - - - - - - - - -
- - - - - - + + + + + JSDoc: Class: AngularCache + + + + + + + + + + +
+ +

Class: AngularCache

+ + + + + +
+ +
+

+ AngularCache +

+ +
+ +
+
+ + + + +
+

new AngularCache(cacheId, options)

+ + +
+
+ + +
+ Instantiated via $angularCacheFactory(cacheId[, options]) +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
cacheId + + +String + + + + + + + + + + The id of the new cache.
options + + +Object + + + + + + <optional>
+ + + + + +
{{[capacity]: Number, [maxAge]: Number, [cacheFlushInterval]: Number, [aggressiveDelete]: Boolean, [onExpire]: Function, [storageMode]: String, [localStorageImpl]: Object}}
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + +

Methods

+ +
+ +
+

<static> destroy()

+ + +
+
+ + +
+ Completely destroy this cache. +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
+ + + +
+

<static> get(key, onExpire) → {*}

+ + +
+
+ + +
+ Retrieve the item from the cache with the specified key. +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
key + + +String + + + + + + + + + + The key of the item to retrieve.
onExpire + + +Function + + + + + + <optional>
+ + + + + +
Callback to be executed if it is discovered the +requested item has expired.
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +
Returns:
+ + +
+ The value of the item in the cache with the specified key. +
+ + + +
+
+ Type +
+
+ +* + + +
+
+ + + + +
+ + + +
+

<static> info() → {Object}

+ + +
+
+ + +
+ Return an object containing information about this cache. +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +
Returns:
+ + +
+ stats Object containing information about this cache. +
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + +
+ + + +
+

<static> keys() → {Array}

+ + +
+
+ + +
+ Return an array of the keys of all items currently in this cache.. +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +
Returns:
+ + +
+ An array of the keys of all items currently in this cache.. +
+ + + +
+
+ Type +
+
+ +Array + + +
+
+ + + + +
+ + + +
+

<static> keySet() → {Object}

+ + +
+
+ + +
+ Return the set of the keys of all items currently in this cache. +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +
Returns:
+ + +
+ The set of the keys of all items currently in this cache. +
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + +
+ + + +
+

<static> put(key, value, options) → {*}

+ + +
+
+ + +
+ Add a key-value pair with timestamp to the cache. +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
key + + +String + + + + + + + + + + The identifier for the item to add to the cache.
value + + +* + + + + + + + + + + The value of the item to add to the cache.
options + + +Object + + + + + + <optional>
+ + + + + +
{ maxAge: {Number} }
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +
Returns:
+ + +
+ value The value of the item added to the cache. +
+ + + +
+
+ Type +
+
+ +* + + +
+
+ + + + +
+ + + +
+

<static> remove(key)

+ + +
+
+ + +
+ Remove the specified key-value pair from this cache. +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
key + + +String + + + + The key of the key-value pair to remove.
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
+ + + +
+

<static> removeAll()

+ + +
+
+ + +
+ Clear this cache. +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
+ + + +
+

<static> setOptions(options, strict)

+ + +
+
+ + +
+ Configure this cache with the given options. +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + +Object + + + +
strict + + +Boolean + + + + If true then any existing configuration will be reset to defaults before +applying the new options, otherwise only the options specified in the hash will be altered.
+ + + +
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
+ +
+ + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + diff --git a/docs/AngularCacheFactory.html b/docs/AngularCacheFactory.html index 51ee8ea..9ed3700 100644 --- a/docs/AngularCacheFactory.html +++ b/docs/AngularCacheFactory.html @@ -167,7 +167,7 @@
Parameters:
Source:
@@ -242,7 +242,7 @@

Index

Modules