Skip to content
Permalink
Browse files

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`
  • Loading branch information
lgalfaso committed Dec 28, 2014
1 parent 0f9fd2f commit 0e2ac3cd705c02312e3a91786fc338fa0ab585dc
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/ng/cacheFactory.js
@@ -159,13 +159,13 @@ function $CacheFactoryProvider() {
* @returns {*} the value stored.
*/
put: function(key, value) {
if (isUndefined(value)) return;
if (capacity < Number.MAX_VALUE) {
var lruEntry = lruHash[key] || (lruHash[key] = {key: key});

refresh(lruEntry);
}

if (isUndefined(value)) return;
if (!(key in data)) size++;
data[key] = value;

0 comments on commit 0e2ac3c

Please sign in to comment.
You can’t perform that action at this time.