net_instaweb::CacheTestBase::Callback Class Reference

#include "cache_test_base.h"

Inheritance diagram for net_instaweb::CacheTestBase::Callback:
net_instaweb::CacheInterface::Callback

List of all members.

Public Member Functions

CallbackReset ()
virtual bool ValidateCandidate (const GoogleString &key, CacheInterface::KeyState state)
virtual void Done (CacheInterface::KeyState state)
void set_invalid_value (const char *v)

Public Attributes

bool called_
bool validate_called_
CacheInterface::KeyState state_

Detailed Description

Helper class for calling Get on cache implementations that are blocking in nature (e.g. in-memory LRU or blocking file-system).


Member Function Documentation

virtual void net_instaweb::CacheTestBase::Callback::Done ( CacheInterface::KeyState  state  )  [inline, 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.

Implements net_instaweb::CacheInterface::Callback.

virtual bool net_instaweb::CacheTestBase::Callback::ValidateCandidate ( const GoogleString key,
CacheInterface::KeyState  state 
) [inline, virtual]

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 from net_instaweb::CacheInterface::Callback.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Tue May 29 16:34:07 2012 for Page Speed Optimization Libraries by  doxygen 1.6.3