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`
This commit is contained in:
Lucas Galfaso
2014-12-28 16:39:51 +01:00
parent 0f9fd2f642
commit 0e2ac3cd70

View File

@@ -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;