Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 0e2ac3c

Browse files
committed
chore($cache): do not add entry to LRU hash when value is undefined
When adding entries to the cache and the `value` is `undefined`, no entry should be added to the `lruHash`
1 parent 0f9fd2f commit 0e2ac3c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ng/cacheFactory.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,13 @@ function $CacheFactoryProvider() {
159159
* @returns {*} the value stored.
160160
*/
161161
put: function(key, value) {
162+
if (isUndefined(value)) return;
162163
if (capacity < Number.MAX_VALUE) {
163164
var lruEntry = lruHash[key] || (lruHash[key] = {key: key});
164165

165166
refresh(lruEntry);
166167
}
167168

168-
if (isUndefined(value)) return;
169169
if (!(key in data)) size++;
170170
data[key] = value;
171171

0 commit comments

Comments
 (0)