Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Friends | List of all members
net_instaweb::CacheInterface::Callback Class Referenceabstract
Inheritance diagram for net_instaweb::CacheInterface::Callback:
net_instaweb::BlockingCallback net_instaweb::CacheInterface::SynchronousCallback net_instaweb::DelegatingCacheCallback net_instaweb::CacheTestBase::Callback

Public Member Functions

void set_value (const SharedString &value)
 
const SharedStringvalue () const
 
bool DelegatedValidateCandidate (const GoogleString &key, KeyState state)
 
void DelegatedDone (KeyState state)
 

Protected Member Functions

virtual bool ValidateCandidate (const GoogleString &key, KeyState state)
 
virtual void Done (KeyState state)=0
 

Friends

class CacheInterface
 

Member Function Documentation

bool net_instaweb::CacheInterface::Callback::DelegatedValidateCandidate ( const GoogleString key,
KeyState  state 
)
inline

These methods are meant for use of callback subclasses that wrap around other callbacks. Normal cache implementations should just use CacheInterface::ValidateAndReportResult.

virtual void net_instaweb::CacheInterface::Callback::Done ( KeyState  state)
protectedpure virtual

This method is called once the cache implementation has found a match that was accepted by ValidateCandidate (in which case state == kAvailable) or it has failed to do so (state == kNotFound).

Implementations are free to invoke cache operations, as all cache locks are guaranteed to be released.

Implemented in net_instaweb::CacheInterface::SynchronousCallback, net_instaweb::CacheTestBase::Callback, net_instaweb::DelegatingCacheCallback, and net_instaweb::BlockingCallback.

virtual bool net_instaweb::CacheInterface::Callback::ValidateCandidate ( const GoogleString key,
KeyState  state 
)
inlineprotectedvirtual

This method exists to let cache clients do application-specific validation of cache results. This is important for 2-level caches, as with distributed setups it's possible that an entry in the L1 is invalid (e.g. an HTTP resource past expiration), while the L2 cache has a valid result.

This method will be invoked for all potential cache results, (with the value filled in into value()). Returning 'false' lets the implementation effectively veto a value as expired or invalid for semantic reasons.

Note that implementations may not invoke any cache operations, as it may be invoked with locks held.

Reimplemented in net_instaweb::CacheTestBase::Callback, and net_instaweb::DelegatingCacheCallback.


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