This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +18
-11
lines changed
Expand file tree Collapse file tree 1 file changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -59,9 +59,11 @@ function $CacheFactoryProvider() {
5959 return caches [ cacheId ] = {
6060
6161 put : function ( key , value ) {
62- var lruEntry = lruHash [ key ] || ( lruHash [ key ] = { key : key } ) ;
62+ if ( capacity < Number . MAX_VALUE ) {
63+ var lruEntry = lruHash [ key ] || ( lruHash [ key ] = { key : key } ) ;
6364
64- refresh ( lruEntry ) ;
65+ refresh ( lruEntry ) ;
66+ }
6567
6668 if ( isUndefined ( value ) ) return ;
6769 if ( ! ( key in data ) ) size ++ ;
@@ -76,26 +78,31 @@ function $CacheFactoryProvider() {
7678
7779
7880 get : function ( key ) {
79- var lruEntry = lruHash [ key ] ;
81+ if ( capacity < Number . MAX_VALUE ) {
82+ var lruEntry = lruHash [ key ] ;
8083
81- if ( ! lruEntry ) return ;
84+ if ( ! lruEntry ) return ;
8285
83- refresh ( lruEntry ) ;
86+ refresh ( lruEntry ) ;
87+ }
8488
8589 return data [ key ] ;
8690 } ,
8791
8892
8993 remove : function ( key ) {
90- var lruEntry = lruHash [ key ] ;
94+ if ( capacity < Number . MAX_VALUE ) {
95+ var lruEntry = lruHash [ key ] ;
9196
92- if ( ! lruEntry ) return ;
97+ if ( ! lruEntry ) return ;
9398
94- if ( lruEntry == freshEnd ) freshEnd = lruEntry . p ;
95- if ( lruEntry == staleEnd ) staleEnd = lruEntry . n ;
96- link ( lruEntry . n , lruEntry . p ) ;
99+ if ( lruEntry == freshEnd ) freshEnd = lruEntry . p ;
100+ if ( lruEntry == staleEnd ) staleEnd = lruEntry . n ;
101+ link ( lruEntry . n , lruEntry . p ) ;
102+
103+ delete lruHash [ key ] ;
104+ }
97105
98- delete lruHash [ key ] ;
99106 delete data [ key ] ;
100107 size -- ;
101108 } ,
You can’t perform that action at this time.
0 commit comments