mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-01-12 17:12:34 +08:00
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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user