Class ResourceCache

Class Documentation

class backend::ResourceCache

Public Types

enum Strategy

Values:

enumerator kFIFO

Public Functions

inline ResourceCache()
inline explicit ResourceCache(const Config &cache_config)
template<typename DataType>
bool getResource(const ResourceId &id, const ResourceType &type, DataType *resource)
template<typename DataType>
void putResource(const ResourceId &id, const ResourceType &type, const DataType &resource)
template<typename DataType>
bool deleteResource(const ResourceId &id, const ResourceType &type)
void deleteResourceNoDataType(const ResourceId &id, const ResourceType &type)
void resetStatistic()
const CacheStatistic &getStatistic() const
const Config &getConfig() const
template<typename DataType>
struct Cache

Public Types

typedef std::pair<ResourceId, DataType> Element
typedef std::deque<std::pair<ResourceId, DataType>> ResourceDeque
typedef std::unique_ptr<ResourceDeque> ResourceDequePtr
typedef std::unique_ptr<const ResourceDeque> ResourceDequeConstPtr
typedef std::unordered_map<ResourceType, ResourceDequePtr, ResourceTypeHash> ResourceTypeMap
typedef ResourceDeque::const_iterator ConstIterator
typedef ResourceDeque::iterator Iterator
struct Config

Public Members

size_t allocated_cache_size = 0u
size_t max_cache_size = 100u
bool cache_newest_resource = false
Strategy strategy = Strategy::kFIFO