1
1
/*!
2
2
* angular-cache
3
- * @version 4.3.2 - Homepage <http://jmdobry.github.io/angular-cache/>
3
+ * @version 4.4.0 - Homepage <http://jmdobry.github.io/angular-cache/>
4
4
* @author Jason Dobry <[email protected] >
5
5
* @copyright (c) 2013-2015 Jason Dobry
6
6
* @license MIT <https://github.com/jmdobry/angular-cache/blob/master/LICENSE>
@@ -84,6 +84,7 @@ return /******/ (function(modules) { // webpackBootstrap
84
84
_classCallCheck ( this , CacheFactoryProvider ) ;
85
85
86
86
this . defaults = CacheFactory . defaults ;
87
+ this . defaults . storagePrefix = 'angular-cache.caches.' ;
87
88
88
89
this . $get = [ '$q' , function ( $q ) {
89
90
CacheFactory . utils . Promise = $q ;
@@ -94,11 +95,13 @@ return /******/ (function(modules) { // webpackBootstrap
94
95
angular . module ( 'angular-cache' , [ ] ) . provider ( 'BinaryHeap' , BinaryHeapProvider ) . provider ( 'CacheFactory' , CacheFactoryProvider ) ;
95
96
96
97
module . exports = 'angular-cache' ;
97
- module . exports . name = 'angular-cache' ;
98
+ try {
99
+ module . exports . name = 'angular-cache' ;
100
+ } catch ( err ) { }
98
101
99
102
/***/ } ,
100
103
/* 1 */
101
- /***/ function ( module , exports , __webpack_require__ ) {
104
+ /***/ function ( module , exports ) {
102
105
103
106
module . exports = __WEBPACK_EXTERNAL_MODULE_1__ ;
104
107
@@ -108,7 +111,7 @@ return /******/ (function(modules) { // webpackBootstrap
108
111
109
112
/*!
110
113
* cachefactory
111
- * @version 1.1 .0 - Homepage <http://jmdobry.github.io/cachefactory/>
114
+ * @version 1.2 .0 - Homepage <http://jmdobry.github.io/cachefactory/>
112
115
* @author Jason Dobry <[email protected] >
113
116
* @copyright (c) 2013-2015 Jason Dobry
114
117
* @license MIT <https://github.com/jmdobry/cachefactory/blob/master/LICENSE>
@@ -119,7 +122,7 @@ return /******/ (function(modules) { // webpackBootstrap
119
122
if ( true )
120
123
module . exports = factory ( ) ;
121
124
else if ( typeof define === 'function' && define . amd )
122
- define ( factory ) ;
125
+ define ( [ ] , factory ) ;
123
126
else if ( typeof exports === 'object' )
124
127
exports [ "CacheFactory" ] = factory ( ) ;
125
128
else
@@ -407,7 +410,7 @@ return /******/ (function(modules) { // webpackBootstrap
407
410
created : item . created ,
408
411
accessed : item . accessed ,
409
412
expires : item . expires ,
410
- isExpired : new Date ( ) . getTime ( ) - item . created > this . $$maxAge
413
+ isExpired : new Date ( ) . getTime ( ) - item . created > ( item . maxAge || this . $$maxAge )
411
414
} ;
412
415
} else {
413
416
return undefined ;
@@ -420,7 +423,7 @@ return /******/ (function(modules) { // webpackBootstrap
420
423
created : item . created ,
421
424
accessed : item . accessed ,
422
425
expires : item . expires ,
423
- isExpired : new Date ( ) . getTime ( ) - item . created > this . $$maxAge
426
+ isExpired : new Date ( ) . getTime ( ) - item . created > ( item . maxAge || this . $$maxAge )
424
427
} ;
425
428
} else {
426
429
return undefined ;
@@ -523,7 +526,11 @@ return /******/ (function(modules) { // webpackBootstrap
523
526
accessed : now
524
527
} ;
525
528
526
- item . expires = item . created + this . $$maxAge ;
529
+ if ( options . maxAge ) {
530
+ item . maxAge = options . maxAge ;
531
+ }
532
+
533
+ item . expires = item . created + ( item . maxAge || this . $$maxAge ) ;
527
534
528
535
if ( $$storage ) {
529
536
if ( _isPromiseLike ( item . value ) ) {
@@ -759,7 +766,7 @@ return /******/ (function(modules) { // webpackBootstrap
759
766
if ( this . $$maxAge === Number . MAX_VALUE ) {
760
767
item . expires = Number . MAX_VALUE ;
761
768
} else {
762
- item . expires = item . created + this . $$maxAge ;
769
+ item . expires = item . created + ( item . maxAge || this . $$maxAge ) ;
763
770
}
764
771
$$expiresHeap . push ( {
765
772
key : key ,
@@ -775,7 +782,7 @@ return /******/ (function(modules) { // webpackBootstrap
775
782
if ( this . $$maxAge === Number . MAX_VALUE ) {
776
783
$$data [ key ] . expires = Number . MAX_VALUE ;
777
784
} else {
778
- $$data [ key ] . expires = $$data [ key ] . created + this . $$maxAge ;
785
+ $$data [ key ] . expires = $$data [ key ] . created + ( $$data [ key ] . maxAge || this . $$maxAge ) ;
779
786
}
780
787
$$expiresHeap . push ( $$data [ key ] ) ;
781
788
}
@@ -905,18 +912,16 @@ return /******/ (function(modules) { // webpackBootstrap
905
912
var shouldReInsert = false ;
906
913
var items = { } ;
907
914
908
- if ( typeof this . $$storageMode === 'string' && this . $$storageMode !== storageMode ) {
909
- var keys = this . keys ( ) ;
915
+ var keys = this . keys ( ) ;
910
916
911
- if ( keys . length ) {
912
- for ( var i = 0 ; i < keys . length ; i ++ ) {
913
- items [ keys [ i ] ] = this . get ( keys [ i ] ) ;
914
- }
915
- for ( i = 0 ; i < keys . length ; i ++ ) {
916
- this . remove ( keys [ i ] ) ;
917
- }
918
- shouldReInsert = true ;
917
+ if ( keys . length ) {
918
+ for ( var i = 0 ; i < keys . length ; i ++ ) {
919
+ items [ keys [ i ] ] = this . get ( keys [ i ] ) ;
920
+ }
921
+ for ( i = 0 ; i < keys . length ; i ++ ) {
922
+ this . remove ( keys [ i ] ) ;
919
923
}
924
+ shouldReInsert = true ;
920
925
}
921
926
922
927
this . $$storageMode = storageMode ;
0 commit comments