Page Speed Optimization Libraries
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
net_instaweb::OptionsAwareHTTPCacheCallback Class Reference

#include "rewrite_driver.h"

Inheritance diagram for net_instaweb::OptionsAwareHTTPCacheCallback:

Public Member Functions

virtual bool IsCacheValid (const GoogleString &key, const ResponseHeaders &headers)
virtual int64 OverrideCacheTtlMs (const GoogleString &key)
virtual ResponseHeaders::VaryOption RespectVaryOnResources () const
- Public Member Functions inherited from net_instaweb::HTTPCache::Callback
 Callback (const RequestContextPtr &request_ctx)
 Callback (const RequestContextPtr &request_ctx, RequestHeaders::Properties req_properties)
virtual void Done (FindResult find_result)=0
virtual bool IsFresh (const ResponseHeaders &headers)
void ReportLatencyMs (int64 latency_ms)
HTTPValuehttp_value ()
ResponseHeadersresponse_headers ()
const ResponseHeadersresponse_headers () const
void set_response_headers (ResponseHeaders *headers)
HTTPValuefallback_http_value ()
const RequestContextPtrrequest_context ()
void set_is_background (bool is_background)
RequestHeaders::Properties req_properties () const

Static Public Member Functions

static bool IsCacheValid (const GoogleString &key, const RewriteOptions &rewrite_options, const RequestContextPtr &request_ctx, const ResponseHeaders &headers)

Protected Member Functions

 OptionsAwareHTTPCacheCallback (const RewriteOptions *rewrite_options, const RequestContextPtr &request_ctx)

Detailed Description

Subclass of HTTPCache::Callback that incorporates a given RewriteOptions' invalidation policy.

Constructor & Destructor Documentation

net_instaweb::OptionsAwareHTTPCacheCallback::OptionsAwareHTTPCacheCallback ( const RewriteOptions rewrite_options,
const RequestContextPtr request_ctx 

Sub-classes need to ensure that rewrite_options remains valid till Callback::Done finishes.

Member Function Documentation

virtual bool net_instaweb::OptionsAwareHTTPCacheCallback::IsCacheValid ( const GoogleString key,
const ResponseHeaders headers 

A method that allows client Callbacks to apply invalidation checks. We first (in check whether the entry is expired using normal http semantics, and if it is not expired, then this check is called – thus callbacks can apply any further invalidation semantics it wants on otherwise valid entries. But there's no way for a callback to override when the HTTP semantics say the entry is expired.

See also OptionsAwareHTTPCacheCallback in rewrite_driver.h for an implementation you probably want to use.

Reimplemented from net_instaweb::HTTPCache::Callback.

static bool net_instaweb::OptionsAwareHTTPCacheCallback::IsCacheValid ( const GoogleString key,
const RewriteOptions rewrite_options,
const RequestContextPtr request_ctx,
const ResponseHeaders headers 

Validates the specified response for the URL, request, given the specified options. This is for checking if cache response can still be used, not for determining whether an entry should be written to an HTTP cache.

virtual int64 net_instaweb::OptionsAwareHTTPCacheCallback::OverrideCacheTtlMs ( const GoogleString key)

Overrides the cache ttl of the cached response with the given value. Note that this has no effect if the returned value is negative or less than the cache ttl of the stored value.

Reimplemented from net_instaweb::HTTPCache::Callback.

virtual ResponseHeaders::VaryOption net_instaweb::OptionsAwareHTTPCacheCallback::RespectVaryOnResources ( ) const

Determines whether this Get request was made in the context where arbitrary Vary headers should be respected.

Note that Vary:Accept-Encoding is ignored at this level independent of this setting, and Vary:Cookie is always respected independent of this setting. Vary:Cookie prevents cacheing resources. For HTML, however, we can cache Vary:Cookie responses as long as there is no cookie in the request.

Implements net_instaweb::HTTPCache::Callback.

The documentation for this class was generated from the following file: