19 #ifndef NET_INSTAWEB_UTIL_PUBLIC_PURGE_SET_H_
20 #define NET_INSTAWEB_UTIL_PUBLIC_PURGE_SET_H_
31 namespace net_instaweb {
45 class InvalidationTimestampHelper;
98 int64 global_invalidation_timestamp_ms()
const {
99 return global_invalidation_timestamp_ms_;
102 bool has_global_invalidation_timestamp_ms()
const {
106 Iterator Begin()
const {
return lru_->Begin(); }
107 Iterator End()
const {
return lru_->End(); }
109 int num_elements()
const {
return lru_->num_elements(); }
113 bool Equals(
const PurgeSet& that)
const;
119 class InvalidationTimestampHelper {
121 explicit InvalidationTimestampHelper(
PurgeSet* purge_set)
122 : purge_set_(purge_set) {
125 size_t size(int64 value)
const {
126 return sizeof(value);
128 bool Equal(int64 a, int64 b)
const {
134 void EvictNotify(int64 evicted_record_timestamp_ms) {
135 purge_set_->EvictNotify(evicted_record_timestamp_ms);
139 bool ShouldReplace(int64 old_timestamp_ms, int64 new_timestamp_ms)
const {
140 return new_timestamp_ms > old_timestamp_ms;
143 void Swap(InvalidationTimestampHelper* that) {
144 std::swap(purge_set_, that->purge_set_);
151 friend class InvalidationTimestampHelper;
153 void EvictNotify(int64 evicted_record_timestamp_ms);
174 bool SanitizeTimestamp(int64* timestamp_ms);
178 int64 global_invalidation_timestamp_ms_;
183 int64 last_invalidation_timestamp_ms_;
185 InvalidationTimestampHelper helper_;
186 scoped_ptr<Lru> lru_;
void set_max_size(size_t x)
Call this immediately after construction.
Definition: purge_set.h:72
static const int64 kInitialTimestampMs
Definition: purge_set.h:60
bool UpdateGlobalInvalidationTimestampMs(int64 timestamp_ms)
bool IsValid(const GoogleString &key, int64 timestamp_ms) const
Definition: purge_set.h:44
Definition: lru_cache_base.h:61
bool Put(const GoogleString &key, int64 timestamp_ms)
void Merge(const PurgeSet &src)
Merge two invalidation records.
Definition: lru_cache_base.h:70
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
static const int64 kClockSkewAllowanceMs
Definition: purge_set.h:56