#include <TableFunctionsCommon.h>
|
bool | isKeyCached (const std::string &key) const |
|
std::shared_ptr< T > | getDataForKey (const std::string &key) const |
|
void | putDataForKey (const std::string &key, std::shared_ptr< T > const data) |
|
template<typename T>
class DataCache< T >
Definition at line 127 of file TableFunctionsCommon.h.
template<typename T >
std::shared_ptr< T > DataCache< T >::getDataForKey |
( |
const std::string & |
key | ) |
const |
Definition at line 532 of file TableFunctionsCommon.cpp.
534 const auto& cached_data_itr =
data_cache_.find(key);
536 const std::string error_msg{
"Data for key " + key +
" not found in cache."};
537 throw std::runtime_error(error_msg);
539 return cached_data_itr->second;
heavyai::shared_lock< heavyai::shared_mutex > read_lock
std::unordered_map< std::string, std::shared_ptr< T > > data_cache_
std::shared_mutex cache_mutex_
template<typename T >
bool DataCache< T >::isKeyCached |
( |
const std::string & |
key | ) |
const |
Definition at line 526 of file TableFunctionsCommon.cpp.
heavyai::shared_lock< heavyai::shared_mutex > read_lock
std::unordered_map< std::string, std::shared_ptr< T > > data_cache_
std::shared_mutex cache_mutex_
template<typename T >
void DataCache< T >::putDataForKey |
( |
const std::string & |
key, |
|
|
std::shared_ptr< T > const |
data |
|
) |
| |
Definition at line 543 of file TableFunctionsCommon.cpp.
545 const auto& cached_data_itr =
data_cache_.find(key);
547 const std::string warning_msg =
548 "Data for key " + key +
" already exists in cache. Replacing.";
549 std::cout << warning_msg << std::endl;
550 cached_data_itr->second.reset();
551 cached_data_itr->second = data;
std::unordered_map< std::string, std::shared_ptr< T > > data_cache_
heavyai::unique_lock< heavyai::shared_mutex > write_lock
std::shared_mutex cache_mutex_
template<typename T >
std::shared_mutex DataCache< T >::cache_mutex_ |
|
mutableprivate |
template<typename T >
std::unordered_map<std::string, std::shared_ptr<T> > DataCache< T >::data_cache_ |
|
private |
The documentation for this class was generated from the following files:
- /home/jenkins-slave/workspace/core-os-doxygen/QueryEngine/TableFunctions/SystemFunctions/os/Shared/TableFunctionsCommon.h
- /home/jenkins-slave/workspace/core-os-doxygen/QueryEngine/TableFunctions/SystemFunctions/os/Shared/TableFunctionsCommon.cpp