|
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) |
| Try get object from cache. | |
| plask::shared_ptr< Value > | get (plask::shared_ptr< Key > index) |
| Try get object from cache. | |
| 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. | |
| void | cleanDeleted () |
| Clean all entries for which values are already deleted. | |
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 sores only weak_ptr to values, so it not prevent values from deletion. Cache entries are removed on key changes (see deleteStrategy) or when value expires (only at moment of getting from non-const cache or calling cleanDeleted).
| 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 weak_ptr; |
| deleteStrategy | when cache entries should be deleted:
|