Granada  1.54.0
Structured layer on top of C++ REST SDK for building server applications in C++. Granada implements sessions, server side plug-in framework, C++ OAuth 2.0 server, data storage access, server script running, server browsing.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Member Functions | List of all members
granada::cache::CacheHandler Class Referenceabstract

#include <cache_handler.h>

Inheritance diagram for granada::cache::CacheHandler:
granada::cache::RedisCacheDriver granada::cache::SharedMapCacheDriver

Public Member Functions

 CacheHandler ()
 
virtual ~CacheHandler ()
 
virtual const bool Exists (const std::string &key)=0
 
virtual const bool Exists (const std::string &hash, const std::string &key)=0
 
virtual const std::string Read (const std::string &key)=0
 
virtual const std::string Read (const std::string &hash, const std::string &key)=0
 
virtual const void Match (const std::string &expression, std::vector< std::string > &keys)
 
virtual void Write (const std::string &key, const std::string &value)=0
 
virtual void Write (const std::string &hash, const std::string &key, const std::string &value)=0
 
virtual void Destroy (const std::string &key)=0
 
virtual void Destroy (const std::string &hash, const std::string &key)=0
 
virtual bool Rename (const std::string &old_key, const std::string &new_key)=0
 
virtual std::unique_ptr
< granada::cache::CacheHandlerIterator
make_iterator (const std::string &expression)=0
 

Detailed Description

Manages cache, data stored as key-value pairs, data can be persistant or not.

Constructor & Destructor Documentation

granada::cache::CacheHandler::CacheHandler ( )
inline

Contructor

virtual granada::cache::CacheHandler::~CacheHandler ( )
inlinevirtual

Destructor

Member Function Documentation

virtual void granada::cache::CacheHandler::Destroy ( const std::string &  key)
pure virtual

Removes a key-value pair from the cache.

Parameters
key

Implemented in granada::cache::RedisCacheDriver, and granada::cache::SharedMapCacheDriver.

virtual void granada::cache::CacheHandler::Destroy ( const std::string &  hash,
const std::string &  key 
)
pure virtual

Destroys a key-value pair stored in a set.

Parameters
hashName of the set where the key-value pair is stored.
keyKey associated with the value.

Implemented in granada::cache::RedisCacheDriver, and granada::cache::SharedMapCacheDriver.

virtual const bool granada::cache::CacheHandler::Exists ( const std::string &  key)
pure virtual

Returns true if key exists, false if it does not.

Parameters
keyKey.
Returns
True if key exists, false if it does not.

Implemented in granada::cache::RedisCacheDriver, and granada::cache::SharedMapCacheDriver.

virtual const bool granada::cache::CacheHandler::Exists ( const std::string &  hash,
const std::string &  key 
)
pure virtual

Checks if a key exist in a set with given hash.

Parameters
hashName of the set of key-value.
keyKey of the value
Returns
True if exist, false if it does not.

Implemented in granada::cache::RedisCacheDriver, and granada::cache::SharedMapCacheDriver.

virtual std::unique_ptr<granada::cache::CacheHandlerIterator> granada::cache::CacheHandler::make_iterator ( const std::string &  expression)
pure virtual

Returns an iterator to iterate over keys with an expression.

Implemented in granada::cache::RedisCacheDriver, and granada::cache::SharedMapCacheDriver.

virtual const void granada::cache::CacheHandler::Match ( const std::string &  expression,
std::vector< std::string > &  keys 
)
inlinevirtual

Fills a vector of strings with the the keys that match an expression.

Parameters
expressionExpression. Example: *:GHs98Ev4GLkqw32g8
keysVector of strings that should be filled with the keys matching the given expression/pattern. Example: plugin:value:GHs98Ev4GLkqw32g8 plugin.handler:value:GHs98Ev4GLkqw32g8 plugin:store:GHs98Ev4GLkqw32g8
virtual const std::string granada::cache::CacheHandler::Read ( const std::string &  key)
pure virtual

Returns value from the cache.

Parameters
keyKey of the value.
Returns
Value

Implemented in granada::cache::RedisCacheDriver, and granada::cache::SharedMapCacheDriver.

virtual const std::string granada::cache::CacheHandler::Read ( const std::string &  hash,
const std::string &  key 
)
pure virtual

Returns the value stored in a set and associated with the given key.

Parameters
hashName of the set where the key-value pairs are stored.
keyKey associated with the value.
Returns
Value.

Implemented in granada::cache::RedisCacheDriver, and granada::cache::SharedMapCacheDriver.

virtual bool granada::cache::CacheHandler::Rename ( const std::string &  old_key,
const std::string &  new_key 
)
pure virtual

Renames a key if it does not already exists.

Parameters
old_keyOld key to rename.
new_keyNew key.
Returns
True if the key could be renamed, false if not, for example it will return false if the new key already existed or the old_key does not exist.

Implemented in granada::cache::RedisCacheDriver, and granada::cache::SharedMapCacheDriver.

virtual void granada::cache::CacheHandler::Write ( const std::string &  key,
const std::string &  value 
)
pure virtual

Sets a value in the cache associated with a given key.

Parameters
keyKey of the value.
valueValue.

Implemented in granada::cache::RedisCacheDriver, and granada::cache::SharedMapCacheDriver.

virtual void granada::cache::CacheHandler::Write ( const std::string &  hash,
const std::string &  key,
const std::string &  value 
)
pure virtual

Inserts or rewrite a key-value pair in a set with the given name. If the set does not exist, it creates it.

Parameters
hashName of the set.
keyKey to identify the value inside the set.
valueValue

Implemented in granada::cache::RedisCacheDriver, and granada::cache::SharedMapCacheDriver.


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