ddc
|
LRU cache for faster "paging" through daughter hits for a branch server. More...
#include <NavHint.h>
Public Types | |
typedef NavHintKey | KeyT |
navigation cache key type More... | |
typedef NavHint | ValT |
navigation cache value type More... | |
typedef ddcLRUCache< KeyT, ValT > | CacheT |
typedef for underlying LRU cache object More... | |
Public Member Functions | |
NavHintCache (size_t capacity=1024) | |
~NavHintCache () | |
default destructor (empty) More... | |
void | reserve (size_t capacity_) |
wraps lock(); m_Cache.reserve(capacity_); unlock() More... | |
size_t | size () const |
wraps lock(); m_Cache.size(); unlock() More... | |
void | clear () |
wraps lock(); m_Cache.clear(); unlock() More... | |
bool | lower_bound (ValT &val, const KeyT &key, bool doPromote=true) |
ValT | lower_bound (const KeyT &key, bool doPromote=true) |
void | insert (const KeyT &key, const ValT &val) |
ValT | lower_bound (const string &QueryStr, size_t HitNo) |
wrapper for lower_bound(KeyT(QueryStr, HitNo)) More... | |
void | insert (const string &QueryStr, size_t HitNo, const string &SortKey, const size_t Offset, const vector< string > &DtrHints) |
wrapper for insert(KeyT(QueryStr, HitNo), ValT(SortKey,Offset,DtrHints)) More... | |
string | toJson () const |
debug: stringification More... | |
Public Member Functions inherited from ddcLockable | |
ddcLockable () | |
virtual | ~ddcLockable () |
int | lock () const |
int | unlock () const |
Public Attributes | |
CacheT | m_Cache |
underlying LRU cache More... | |
Public Attributes inherited from ddcLockable | |
pthread_mutex_t | m_Mutex |
LRU cache for faster "paging" through daughter hits for a branch server.
typedef NavHintKey NavHintCache::KeyT |
navigation cache key type
typedef NavHint NavHintCache::ValT |
navigation cache value type
typedef ddcLRUCache<KeyT,ValT> NavHintCache::CacheT |
typedef for underlying LRU cache object
|
inline |
default constructor
|
inline |
default destructor (empty)
|
inline |
wraps lock(); m_Cache.reserve(capacity_); unlock()
References ddcLRUCache< Key, Val >::reserve().
|
inline |
wraps lock(); m_Cache.size(); unlock()
References ddcLRUCache< Key, Val >::size().
|
inline |
wraps lock(); m_Cache.clear(); unlock()
References ddcLRUCache< Key, Val >::clear().
get lower bound for key key = (QueryStr,HitNo)
val | (output) hint to be extracted (data copied from cache if found, otherwise an empty hint) |
key | (input) key to search for |
doPromote | (input) whether to implicitly promote match to MRU position |
References NavHint::clear(), ddcLogTrace, escapeCString(), Format(), NavHintKey::m_QueryStr, NAVCACHE_TRACE, and NavHintKey::toString().
get lower bound for key key = (QueryStr,HitNo)
insert new entry for key = (QueryStr,HitNo)
References ddcLogTrace, escapeCString(), Format(), ddcLRUCache< Key, Val >::insert(), NAVCACHE_TRACE, NavHintKey::toString(), and NavHint::toString().
|
inline |
wrapper for lower_bound(KeyT(QueryStr, HitNo))
|
inline |
wrapper for insert(KeyT(QueryStr, HitNo), ValT(SortKey,Offset,DtrHints))
References NavHintKey::toJson().
string NavHintCache::toJson | ( | ) | const |
debug: stringification
References Format(), listPos(), and NAVCACHE_VERBOSE_JSON.