PLaSK library
|
Cache values of type Value using Key type to index it. More...
#include <plask/utils/cache.hpp>
Public Member Functions | |
plask::shared_ptr< Value > | get (Key *index) const |
Try get object from cache. | |
plask::shared_ptr< Value > | get (plask::shared_ptr< Key > index) const |
Try get object from cache. | |
Public Member Functions inherited from plask::CacheBase< Key, ValuePtr, DeleteStrategy > | |
~CacheBase () | |
Clear cache. | |
void | append (Key *index, ValuePtr value) |
Append entry to cache. | |
void | append (plask::shared_ptr< Key > index, ValuePtr value) |
Append entry to cache. | |
plask::shared_ptr< Value > | operator() (Key *index, Value *value) |
Construct shared pointer to value and append cache entry which consists of given index and constructed shared pointer. | |
plask::shared_ptr< Value > | operator() (Key *index, shared_ptr< Value > value) |
Append cache entry which consists of given index and value and return value. | |
plask::shared_ptr< Value > | operator() (plask::shared_ptr< Key > index, Value *value) |
Construct shared pointer to value and append cache entry which consists of given index and constructed shared pointer. | |
plask::shared_ptr< Value > | operator() (plask::shared_ptr< Key > index, shared_ptr< Value > value) |
Construct shared pointer to value and append cache entry which consists of given index and constructed shared pointer. | |
void | clear () |
Remove all entries from this cache. | |
Additional Inherited Members | |
Public Types inherited from plask::CacheBase< Key, ValuePtr, DeleteStrategy > | |
typedef ValuePtr::element_type | Value |
Cache values of type Value using Key type to index it.
It stores shared_ptr to values, so each value will be live when it's only is included in cache. Cache entries are removed on key changes (see deleteStrategy
).
Key | type using as index in cache (pointer to this type will be used), must be able to emit events; |
Value | type for cache values, will be stored in shared_ptr; |
deleteStrategy | when cache entries should be deleted:
|