Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Unified Diff: net/base/host_cache.h

Issue 9197009: Adds custom ttl argument to HostCache::Set. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/base/host_cache.h
diff --git a/net/base/host_cache.h b/net/base/host_cache.h
index 62c07ab978f51ee76132809e70b16eacea79aa8b..9bb8e9e0ae7b071bdd7c43f3a64cac2daf8cdd16 100644
--- a/net/base/host_cache.h
+++ b/net/base/host_cache.h
@@ -73,12 +73,8 @@ class NET_EXPORT HostCache : NON_EXPORTED_BASE(public base::NonThreadSafe) {
typedef std::map<Key, scoped_refptr<Entry> > EntryMap;
- // Constructs a HostCache that caches successful host resolves for
- // |success_entry_ttl| time, and failed host resolves for
- // |failure_entry_ttl|. The cache will store up to |max_entries|.
- HostCache(size_t max_entries,
- base::TimeDelta success_entry_ttl,
- base::TimeDelta failure_entry_ttl);
+ // Constructs a HostCache that stores up to |max_entries|.
+ explicit HostCache(size_t max_entries);
~HostCache();
@@ -88,12 +84,13 @@ class NET_EXPORT HostCache : NON_EXPORTED_BASE(public base::NonThreadSafe) {
// Overwrites or creates an entry for |key|. Returns the pointer to the
// entry, or NULL on failure (fails if caching is disabled).
- // (|error|, |addrlist|) is the value to set, and |now| is the current
- // timestamp.
+ // (|error|, |addrlist|) is the value to set, |now| is the current time
+ // |ttl| is the "time to live".
Entry* Set(const Key& key,
int error,
const AddressList& addrlist,
- base::TimeTicks now);
+ base::TimeTicks now,
+ base::TimeDelta ttl);
// Empties the cache
void clear();
@@ -104,10 +101,6 @@ class NET_EXPORT HostCache : NON_EXPORTED_BASE(public base::NonThreadSafe) {
// Following are used by net_internals UI.
size_t max_entries() const;
- base::TimeDelta success_entry_ttl() const;
-
- base::TimeDelta failure_entry_ttl() const;
-
// Note that this map may contain expired entries.
const EntryMap& entries() const;
@@ -133,10 +126,6 @@ class NET_EXPORT HostCache : NON_EXPORTED_BASE(public base::NonThreadSafe) {
// Bound on total size of the cache.
size_t max_entries_;
- // Time to live for cache entries.
- base::TimeDelta success_entry_ttl_;
- base::TimeDelta failure_entry_ttl_;
-
// Map from hostname (presumably in lowercase canonicalized format) to
// a resolved result entry.
EntryMap entries_;

Powered by Google App Engine
This is Rietveld 408576698