glass3::util::Cache class - a thread safe in-memory cache
More...
#include <cache.h>
|
| std::shared_ptr< const json::Object > | m_Config |
| | A shared pointer to the json::Object that holds the configuration. More...
|
| |
| std::atomic< bool > | m_bIsSetup |
| | the boolean flag indicating whether the class has been setup, set to true if setup was successful. More...
|
| |
| std::string | m_DefaultAgencyID |
| | A std::string containing the default agency id to use in parsing if one is not provided. More...
|
| |
| std::string | m_DefaultAuthor |
| | A std::string containing the default author to use in parsing if one is not provided. More...
|
| |
glass3::util::Cache class - a thread safe in-memory cache
The glass3::util::Cache class is a class implementing an in-memory cache of shared_ptr's to json::Objects as a std::map. The cache supports iteration, and is thread safe.
Cache inherits from the baseclass class.
| glass3::util::Cache::Cache |
( |
| ) |
|
Cache constructor.
The Cache for the lookup class. Initializes members to default values.
| glass3::util::Cache::~Cache |
( |
| ) |
|
|
virtual |
Cache destructor.
The destructor for the Cache class.
| bool glass3::util::Cache::addToCache |
( |
std::shared_ptr< json::Object > |
data, |
|
|
std::string |
id |
|
) |
| |
|
virtual |
add data to Cache
Add the provided data identified by the provided id to the Cache
- Parameters
-
| data | - A pointer to a json::Object to add to the Cache |
| id | - A std::string that contains the key that identifies the data to add |
- Returns
- returns true if successful, false otherwise.
| void glass3::util::Cache::clear |
( |
| ) |
|
|
overridevirtual |
| std::shared_ptr< const json::Object > glass3::util::Cache::getFromCache |
( |
std::string |
id | ) |
|
|
virtual |
get data from Cache
Get the data identified by the provided id from the Cache
- Parameters
-
| id | - A std::string that contains the key that identifies the data to get |
- Returns
- returns a pointer to the json::Object containing the data, NULL if the data was not found
| std::shared_ptr< const json::Object > glass3::util::Cache::getNextFromCache |
( |
bool |
restart = false | ) |
|
|
virtual |
get next data from Cache
Gets the next data available from the Cache
- Parameters
-
| restart | - A boolean flag indicating whether to start at the beginning of the Cache |
- Returns
- returns a pointer to the json::Object containing the next data, NULL if there is no more data available.
| bool glass3::util::Cache::isEmpty |
( |
| ) |
|
|
virtual |
check if Cache empty
Check to see if the Cache is empty
- Returns
- returns true if empty, false otherwise.
| bool glass3::util::Cache::isInCache |
( |
std::string |
id | ) |
|
|
virtual |
check for data in Cache
Check to see if the data identified by the provided id is in the Cache
- Parameters
-
| id | - A std::string that contains the key that identifies the data to remove |
- Returns
- returns true if successful, false otherwise.
| bool glass3::util::Cache::removeFromCache |
( |
std::string |
id | ) |
|
|
virtual |
remove data from Cache
Remove the data identified by the provided id from the Cache
- Parameters
-
| id | - A std::string that contains the key that identifies the data to remove |
- Returns
- returns true if successful, false otherwise.
| int glass3::util::Cache::size |
( |
| ) |
|
Retrieves the current size of the Cache.
The documentation for this class was generated from the following files: