Page Speed Optimization Libraries
1.13.35.1
|
#include "cache_test_base.h"
Public Member Functions | |
Callback (CacheTestBase *test) | |
Callback * | Reset () |
virtual bool | ValidateCandidate (const GoogleString &key, CacheInterface::KeyState state) |
virtual void | Done (CacheInterface::KeyState state) |
virtual void | Wait () |
void | set_invalid_value (const char *v) |
void | set_invalid_key (const char *k) |
StringPiece | value_str () |
Public Member Functions inherited from net_instaweb::CacheInterface::SynchronousCallback | |
bool | called () const |
KeyState | state () const |
void | Reset () |
super.value(), super.set_value() are used to get/set the value. | |
Public Member Functions inherited from net_instaweb::CacheInterface::Callback | |
void | set_value (const SharedString &value) |
const SharedString & | value () const |
bool | DelegatedValidateCandidate (const GoogleString &key, KeyState state) |
void | DelegatedDone (KeyState state) |
Public Attributes | |
bool | validate_called_ |
bool | noop_wait_called_ |
bool | value_of_called_when_wait_was_invoked_ |
Additional Inherited Members |
Helper class for calling Get on cache implementations that are blocking in nature (e.g. in-memory LRU or blocking file-system). Also tests the CacheInterface::SynchronousCallback class in the process.
|
inlinevirtual |
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.
Reimplemented from net_instaweb::CacheInterface::SynchronousCallback.
|
inlinevirtual |
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.
|
inlinevirtual |
The default implementation has an empty Wait implementation. If you override this, be sure also to call set_mutex() from the test subclass constructor or SetUp to protect outstanding_fetches_.