19 #ifndef NET_INSTAWEB_HTTP_PUBLIC_CACHE_URL_ASYNC_FETCHER_H_
20 #define NET_INSTAWEB_HTTP_PUBLIC_CACHE_URL_ASYNC_FETCHER_H_
26 namespace net_instaweb {
33 class NamedLockManager;
74 NamedLockManager* lock_manager,
76 const GoogleString& fragment,
79 : lock_hasher_(lock_hasher),
80 lock_manager_(lock_manager),
84 async_op_hooks_(async_op_hooks),
85 backend_first_byte_latency_(NULL),
86 fallback_responses_served_(NULL),
87 fallback_responses_served_while_revalidate_(NULL),
88 num_conditional_refreshes_(NULL),
89 num_proactively_freshen_user_facing_request_(NULL),
91 ignore_recent_fetch_failed_(false),
92 serve_stale_if_fetch_error_(false),
93 default_cache_html_(false),
94 proactively_freshen_user_facing_request_(false),
95 serve_stale_while_revalidate_threshold_sec_(0) {
101 virtual void Fetch(
const GoogleString& url,
102 MessageHandler* message_handler,
109 HTTPCache* http_cache()
const {
return http_cache_; }
112 void set_backend_first_byte_latency_histogram(Histogram* x) {
113 backend_first_byte_latency_ = x;
116 Histogram* backend_first_byte_latency_histogram()
const {
117 return backend_first_byte_latency_;
120 void set_fallback_responses_served(Variable* x) {
121 fallback_responses_served_ = x;
124 Variable* fallback_responses_served()
const {
125 return fallback_responses_served_;
128 void set_fallback_responses_served_while_revalidate(Variable* x) {
129 fallback_responses_served_while_revalidate_ = x;
132 Variable* fallback_responses_served_while_revalidate()
const {
133 return fallback_responses_served_while_revalidate_;
136 void set_num_conditional_refreshes(Variable* x) {
137 num_conditional_refreshes_ = x;
140 Variable* num_conditional_refreshes()
const {
141 return num_conditional_refreshes_;
144 void set_num_proactively_freshen_user_facing_request(Variable* x) {
145 num_proactively_freshen_user_facing_request_ = x;
148 Variable* num_proactively_freshen_user_facing_request()
const {
149 return num_proactively_freshen_user_facing_request_;
152 void set_respect_vary(
bool x) { respect_vary_ = x; }
153 bool respect_vary()
const {
return respect_vary_; }
155 void set_ignore_recent_fetch_failed(
bool x) {
156 ignore_recent_fetch_failed_ = x;
158 bool ignore_recent_fetch_failed()
const {
159 return ignore_recent_fetch_failed_;
162 void set_serve_stale_if_fetch_error(
bool x) {
163 serve_stale_if_fetch_error_ = x;
166 bool serve_stale_if_fetch_error()
const {
167 return serve_stale_if_fetch_error_;
170 void set_serve_stale_while_revalidate_threshold_sec(int64 x) {
171 serve_stale_while_revalidate_threshold_sec_ = x;
174 int64 serve_stale_while_revalidate_threshold_sec()
const {
175 return serve_stale_while_revalidate_threshold_sec_;
178 void set_default_cache_html(
bool x) { default_cache_html_ = x; }
179 bool default_cache_html()
const {
return default_cache_html_; }
181 void set_proactively_freshen_user_facing_request(
bool x) {
182 proactively_freshen_user_facing_request_ = x;
184 bool proactively_freshen_user_facing_request()
const {
185 return proactively_freshen_user_facing_request_;
190 const Hasher* lock_hasher_;
191 NamedLockManager* lock_manager_;
192 HTTPCache* http_cache_;
193 GoogleString fragment_;
195 AsyncOpHooks* async_op_hooks_;
197 Histogram* backend_first_byte_latency_;
198 Variable* fallback_responses_served_;
199 Variable* fallback_responses_served_while_revalidate_;
200 Variable* num_conditional_refreshes_;
201 Variable* num_proactively_freshen_user_facing_request_;
204 bool ignore_recent_fetch_failed_;
205 bool serve_stale_if_fetch_error_;
206 bool default_cache_html_;
207 bool proactively_freshen_user_facing_request_;
208 int64 serve_stale_while_revalidate_threshold_sec_;
virtual void FinishAsyncOp()=0
Called when async operation is ended.
virtual void StartAsyncOp()=0
Called when CacheUrlAsyncFetcher is about to start async operation.
virtual bool SupportsHttps() const
Definition: cache_url_async_fetcher.h:99
CacheUrlAsyncFetcher(const Hasher *lock_hasher, NamedLockManager *lock_manager, HTTPCache *cache, const GoogleString &fragment, AsyncOpHooks *async_op_hooks, UrlAsyncFetcher *fetcher)
None of these are owned by CacheUrlAsyncFetcher.
Definition: cache_url_async_fetcher.h:73
Definition: async_fetch.h:53
Definition: cache_url_async_fetcher.h:57
Definition: cache_url_async_fetcher.h:61
virtual void Fetch(const GoogleString &url, MessageHandler *message_handler, AsyncFetch *base_fetch)
UrlAsyncFetcher()
Definition: url_async_fetcher.h:81
virtual bool SupportsHttps() const
Definition: url_async_fetcher.h:57
Definition: url_async_fetcher.h:33
static const int kNotInCacheStatus
Definition: cache_url_async_fetcher.h:107
Definition: http_cache.h:46