19 #ifndef PAGESPEED_KERNEL_BASE_CACHE_INTERFACE_H_
20 #define PAGESPEED_KERNEL_BASE_CACHE_INTERFACE_H_
24 #include "base/logging.h"
29 namespace net_instaweb {
45 void set_value(
const SharedString& value) { value_ = value; }
96 bool called()
const {
return called_; }
97 KeyState state()
const {
return state_; }
125 typedef std::vector<KeyCallback> MultiGetRequest;
127 static const char* KeyStateName(
KeyState state);
147 virtual void MultiGet(MultiGetRequest* request);
161 Put(key, shared_string);
virtual void Put(const GoogleString &key, const SharedString &value)=0
Abstract interface for a cache.
Definition: cache_interface.h:32
virtual bool ValidateCandidate(const GoogleString &key, KeyState state)
Definition: cache_interface.h:75
Requested key needs to be written.
Definition: cache_interface.h:36
Cache lookup ended up in network error.
Definition: cache_interface.h:38
Lookup is discarded due to cache server is overloaded.
Definition: cache_interface.h:37
void SwapWithString(GoogleString *str)
bool DelegatedValidateCandidate(const GoogleString &key, KeyState state)
Definition: cache_interface.h:51
Request timeout.
Definition: cache_interface.h:39
Definition: cache_interface.h:92
Requested key is available for serving.
Definition: cache_interface.h:35
void PutSwappingString(const GoogleString &key, GoogleString *value)
Definition: cache_interface.h:158
virtual void Done(CacheInterface::KeyState state)
Definition: cache_interface.h:107
virtual CacheInterface * Backend()
KeyState
Definition: cache_interface.h:34
virtual void MultiGet(MultiGetRequest *request)
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
void Reset()
super.value(), super.set_value() are used to get/set the value.
Definition: cache_interface.h:100
virtual bool IsHealthy() const =0
virtual bool IsBlocking() const =0
virtual void Get(const GoogleString &key, Callback *callback)=0
Vector of structures used to initiate a MultiGet.
Definition: cache_interface.h:120
Definition: shared_string.h:40
Definition: cache_interface.h:42
void ReportMultiGetNotFound(MultiGetRequest *request)
virtual void PutWithKeyInValue(const GoogleString &key, const SharedString &key_and_value)
Definition: cache_interface.h:216
virtual void ShutDown()=0
virtual bool MustEncodeKeyInValueOnPut() const
Definition: cache_interface.h:211
virtual GoogleString Name() const =0
void ValidateAndReportResult(const GoogleString &key, KeyState state, Callback *callback)
Invokes callback->ValidateCandidate() and callback->Done() as appropriate.
virtual void Done(KeyState state)=0