Index: net/base/expiring_cache.h |
diff --git a/net/base/expiring_cache.h b/net/base/expiring_cache.h |
index fe2fc65a0d68d2f6b58da4ba5f06c2f37dd3a666..3cdf42deddae7e6c22d34f2b2e48d8e70deeaad9 100644 |
--- a/net/base/expiring_cache.h |
+++ b/net/base/expiring_cache.h |
@@ -120,11 +120,12 @@ class ExpiringCache { |
return &it->second.first; |
} |
- // Updates or replaces the value associated with |key|. |
- void Put(const KeyType& key, |
- const ValueType& value, |
- const ExpirationType& now, |
- const ExpirationType& expiration) { |
+ // Updates or replaces the value associated with |key|. Returns a pointer to |
+ // the stored value. |
+ ValueType* Put(const KeyType& key, |
+ const ValueType& value, |
+ const ExpirationType& now, |
+ const ExpirationType& expiration) { |
typename EntryMap::iterator it = entries_.find(key); |
if (it == entries_.end()) { |
// Compact the cache if it grew beyond the limit. |
@@ -132,12 +133,13 @@ class ExpiringCache { |
Compact(now); |
// No existing entry. Creating a new one. |
- entries_.insert(std::make_pair(key, Entry(value, expiration))); |
+ it = entries_.insert(std::make_pair(key, Entry(value, expiration))).first; |
} else { |
// Update an existing cache entry. |
it->second.first = value; |
it->second.second = expiration; |
} |
+ return &it->second.first; |
} |
// Empties the cache. |