![]() |
VR-Forces 4.6.1 Class Documentation
|
Least-recently-used cache class. More...

Classes | |
| struct | Functor |
| struct | Record |
Public Member Functions | |
| LRUCache (unsigned max=100) | |
| LRUCache (bool threadsafe, unsigned max=100) | |
| virtual | ~LRUCache () |
| dtor | |
| void | insert (const K &key, const T &value) |
| bool | get (const K &key, Record &out) |
| bool | has (const K &key) |
| void | erase (const K &key) |
| void | clear () |
| void | setMaxSize (unsigned max) |
| unsigned | getMaxSize () const |
| CacheStats | getStats () const |
| void | iterate (Functor &functor) const |
| void | enableDebug (bool enable) |
Protected Types | |
| typedef std::list< K >::iterator | lru_iter |
| typedef std::list< K > | lru_type |
| typedef std::pair< T, lru_iter > | map_value_type |
| typedef std::map< K, map_value_type > | map_type |
| typedef map_type::iterator | map_iter |
| typedef map_type::const_iterator | map_const_iter |
Protected Attributes | |
| map_type | _map |
| lru_type | _lru |
| unsigned | _max |
| unsigned | _buf |
| unsigned | _queries |
| unsigned | _hits |
| bool | _threadsafe |
| Threading::Mutex | _mutex |
Private Member Functions | |
| void | insert_impl (const K &key, const T &value) |
| void | get_impl (const K &key, Record &result) |
| bool | has_impl (const K &key) |
| void | erase_impl (const K &key) |
| void | clear_impl () |
| void | setMaxSize_impl (unsigned max) |
| void | iterate_impl (Functor &f) const |
Private Attributes | |
| bool | myDebug |
Least-recently-used cache class.
K = key type, T = value type
usage: LRUCache<K,T> cache; cache.put( key, value ); LRUCache.Record rec = cache.get( key ); if ( rec.valid() ) const T& value = rec.value();
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
inline |
|
inline |
|
inlinevirtual |
dtor
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
protected |
Referenced by makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::clear_impl(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::erase_impl(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::get_impl(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::getStats(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::has_impl(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::insert_impl(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::iterate_impl(), and makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::setMaxSize_impl().
|
protected |
Referenced by makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::clear_impl(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::erase_impl(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::get_impl(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::insert_impl(), and makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::setMaxSize_impl().
|
protected |
Referenced by makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::getMaxSize(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::getStats(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::insert_impl(), and makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::setMaxSize_impl().
|
protected |
|
protected |
Referenced by makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::clear_impl(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::get_impl(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::getStats(), and makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::LRUCache().
|
protected |
Referenced by makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::clear_impl(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::get_impl(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::getStats(), and makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::LRUCache().
|
protected |
Referenced by makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::clear(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::erase(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::get(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::has(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::insert(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::iterate(), and makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::setMaxSize().
|
mutableprotected |
Referenced by makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::clear(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::erase(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::get(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::has(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::insert(), makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::iterate(), and makVrv::LRUCache< std::string, osg::ref_ptr< osg::Image > >::setMaxSize().
|
private |