Page Speed Optimization Libraries  1.4.26.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions
net_instaweb::HTTPCache::Callback Class Reference

#include "http_cache.h"

Inheritance diagram for net_instaweb::HTTPCache::Callback:
net_instaweb::OptionsAwareHTTPCacheCallback

List of all members.

Public Member Functions

 Callback (const RequestContextPtr &request_ctx)
virtual void Done (FindResult find_result)=0
virtual bool IsCacheValid (const GoogleString &key, const ResponseHeaders &headers)=0
virtual bool IsFresh (const ResponseHeaders &headers)
virtual int64 OverrideCacheTtlMs (const GoogleString &key)
HTTPValuehttp_value ()
ResponseHeadersresponse_headers ()
const ResponseHeadersresponse_headers () const
void set_response_headers (ResponseHeaders *headers)
HTTPValuefallback_http_value ()
LogRecordlog_record ()
const RequestContextPtrrequest_context ()
void set_log_timing (bool t)
bool log_timing () const
virtual void SetTimingMs (int64 timing_value_ms)

Detailed Description

Class to handle an asynchronous cache lookup response.

Todo:
TODO(jmarantz): consider inheriting from AsyncFetch with an implementation of Write/Flush/HeadersComplete -- we'd have to make Done take true/false so this would impact callers.

Member Function Documentation

Todo:
TODO(jmarantz): specify the dataflow between http_value and response_headers.
virtual bool net_instaweb::HTTPCache::Callback::IsCacheValid ( const GoogleString key,
const ResponseHeaders headers 
) [pure virtual]

A method that allows client Callbacks to apply invalidation checks. We first (in http_cache.cc) 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.

Implemented in net_instaweb::OptionsAwareHTTPCacheCallback.

virtual bool net_instaweb::HTTPCache::Callback::IsFresh ( const ResponseHeaders headers) [inline, virtual]

A method that allows client Callbacks to check if the response in cache is fresh enough, in addition to it being valid. This is used while freshening resources to check that the response in cache is not only valid, but is also not going to expire anytime soon. Note that if the response in cache is valid but not fresh, the HTTPCache calls Callback::Done with find_result = kNotFound and fills in fallback_http_value() with the cached response.

virtual int64 net_instaweb::HTTPCache::Callback::OverrideCacheTtlMs ( const GoogleString key) [inline, virtual]

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 in net_instaweb::OptionsAwareHTTPCacheCallback.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines