26 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_CACHEABLE_RESOURCE_BASE_H_
27 #define NET_INSTAWEB_REWRITER_PUBLIC_CACHEABLE_RESOURCE_BASE_H_
29 #include "net/instaweb/http/public/request_context.h"
36 namespace net_instaweb {
43 class ResponseHeaders;
62 AsyncCallback* callback);
78 static void InitStats(StringPiece stat_prefix,
Statistics* statistics);
92 RewriteDriver* rewrite_driver()
const {
return rewrite_driver_; }
93 const RewriteOptions* rewrite_options()
const;
100 class FreshenHttpCacheCallback;
101 class LoadHttpCacheCallback;
102 class FetchCallbackBase;
103 class FreshenFetchCallback;
104 class LoadFetchCallback;
105 friend class CacheableResourceBaseTest;
110 bool UpdateInputInfoForFreshen(
const ResponseHeaders& headers,
111 const HTTPValue& value,
112 Resource::FreshenCallback* callback);
116 bool IsValidAndCacheableImpl(
const ResponseHeaders& headers)
const;
119 MessageHandler* message_handler()
const {
128 Variable* recent_fetch_failures_;
129 Variable* recent_uncacheables_miss_;
130 Variable* recent_uncacheables_failure_;
virtual void LoadAndCallback(NotCacheablePolicy not_cacheable_policy, const RequestContextPtr &request_context, AsyncCallback *callback)
This checks the cache, and fetches the resource if appropriate.
bool ShouldSkipBackgroundFetch() const
ServerContext * server_context() const
Common methods across all deriviations.
Definition: resource.h:77
virtual void PrepareRequest(const RequestContextPtr &request_context, RequestHeaders *headers)
virtual void RefreshIfImminentlyExpiring()
Base class for implementations of monitoring statistics.
Definition: statistics.h:342
virtual void PrepareResponseHeaders(ResponseHeaders *headers)
Definition: resource.h:57
NotCacheablePolicy
Definition: resource.h:68
virtual void Freshen(FreshenCallback *callback, MessageHandler *handler)
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
Definition: rewrite_driver.h:100
CacheableResourceBase(StringPiece stat_prefix, StringPiece url, StringPiece cache_key, const ContentType *type, RewriteDriver *rewrite_driver)
Note: InitStats(stat_prefix) must have been called before.
friend class RewriteDriver
for ReadIfCachedWithStatus
Definition: resource.h:289
Definition: content_type.h:31
virtual bool IsValidAndCacheable() const
Definition: message_handler.h:39
virtual bool UseHttpCache() const
All the public methods here implement the Resource API.
Definition: cacheable_resource_base.h:55
Definition: cacheable_resource_base.h:50
virtual GoogleString cache_key() const
Definition: cacheable_resource_base.h:67
virtual GoogleString url() const
Gets the absolute URL of the resource.
Definition: cacheable_resource_base.h:66
Definition: http_cache.h:67