Page Speed Optimization Libraries
1.5.27.2
|
See file comment. More...
#include "mock_time_cache.h"
Public Member Functions | |
MockTimeCache (Scheduler *scheduler, CacheInterface *cache) | |
Note: takes ownership of nothing. | |
virtual void | Get (const GoogleString &key, Callback *callback) |
Reimplementations of CacheInterface methods. | |
virtual void | Put (const GoogleString &key, SharedString *value) |
virtual void | Delete (const GoogleString &key) |
void | set_delay_us (int64 delay_us) |
int64 | delay_us () const |
Scheduler * | scheduler () |
virtual GoogleString | Name () const |
virtual bool | IsBlocking () const |
virtual bool | IsHealthy () const |
virtual void | ShutDown () |
Static Public Member Functions | |
static GoogleString | FormatName (StringPiece name) |
See file comment.
virtual bool net_instaweb::MockTimeCache::IsBlocking | ( | ) | const [inline, virtual] |
Returns true if this cache is guaranteed to call its callbacks before returning from Get and MultiGet.
Implements net_instaweb::CacheInterface.
virtual bool net_instaweb::MockTimeCache::IsHealthy | ( | ) | const [inline, virtual] |
Returns true if the cache is in a healthy state. Memory and file-based caches can simply return 'true'. But for server-based caches, it is handy to be able to query to see whether it is in a good state. It should be safe to call this frequently -- the implementation shouldn't do much more than check a bool flag under mutex.
Implements net_instaweb::CacheInterface.
virtual GoogleString net_instaweb::MockTimeCache::Name | ( | ) | const [inline, virtual] |
The name of this CacheInterface -- used for logging and debugging.
It is strongly recommended that you provide a static GoogleString FormatName(...) method for use in formatting the Name() return, and in testing, e.g. in net/instaweb/system/system_caches_test.cc.
Implements net_instaweb::CacheInterface.
virtual void net_instaweb::MockTimeCache::Put | ( | const GoogleString & | key, |
SharedString * | value | ||
) | [virtual] |
Puts a value into the cache. The value that is passed in is not modified, but the SharedString is passed by non-const pointer because its reference count is bumped.
Implements net_instaweb::CacheInterface.
void net_instaweb::MockTimeCache::set_delay_us | ( | int64 | delay_us | ) | [inline] |
Sets the delay the cache will inject before invoking the callbacks. Note that this only affects the 'Done' callback; 'ValidateCandidate' happens immediately.
virtual void net_instaweb::MockTimeCache::ShutDown | ( | ) | [inline, virtual] |
Stops all cache activity. Further Put/Delete calls will be dropped, and MultiGet/Get will call the callback with kNotFound immediately. Note there is no Enable(); once the cache is stopped it is stopped forever. This function is intended for use during process shutdown.
Implements net_instaweb::CacheInterface.