ddc
|
common session data, sharable by multiple worker threads extracted from ddc-2.0.x CConcHolder; now CConcSession More...
#include <ConcSessionContext.h>
Public Member Functions | |
CConcSessionContext () | |
~CConcSessionContext () | |
bool | CacheGet (CConcHolder &Holder, const string &Query, DWORD &EndHitNo) |
void | CacheSet (CConcHolder &Holder, const string &Query, vector< size_t >::const_iterator start, vector< size_t >::const_iterator end) |
void | CacheClear () |
size_t | CacheSize () |
Public Member Functions inherited from ddcLockable | |
ddcLockable () | |
virtual | ~ddcLockable () |
int | lock () const |
int | unlock () const |
Public Attributes | |
map< string, CQueryResult > | m_QueryCache |
hit results for the last MaxQueryCacheSize queries More... | |
deque< string > | m_Queries |
a deque for last MaxQueryCacheSize queries; m_Queries.last() is the last given query More... | |
Public Attributes inherited from ddcLockable | |
pthread_mutex_t | m_Mutex |
common session data, sharable by multiple worker threads extracted from ddc-2.0.x CConcHolder; now CConcSession
|
inline |
default constructor
|
inline |
default destructor
References CacheClear(), CacheGet(), CacheSet(), and CacheSize().
bool CConcSessionContext::CacheGet | ( | CConcHolder & | Holder, |
const string & | Query, | ||
DWORD & | EndHitNo | ||
) |
fetch cached result for Query if available
Holder | session object / result set to populate |
Query | query string (cache key) to be fetched |
EndHitNo | on call, index of first hit to retrieve; on return index of last hit retrieved |
References CACHEDEBUG, CACHEDEBUGLOG, CConcSession::ClearQueryResults(), concord_daemon_log(), Format(), jsonStr(), ddcLockable::lock(), CQueryResult::m_AllHitsCount, CQueryResult::m_bSortByString, CQueryResult::m_DebugInfo, CQueryResult::m_HighlightIds, CQueryResult::m_HighlightOccurs, CQueryResult::m_Hits, CConcordance::m_MaxCachedHitsCount, CConcSession::m_pConcordance, m_Queries, m_QueryCache, CQueryResult::m_RelevantDocumentCount, CConcSession::m_ResultLimit, CConcSession::m_ResultOffset, CQueryResult::m_SortOrder, and ddcLockable::unlock().
Referenced by ~CConcSessionContext().
void CConcSessionContext::CacheSet | ( | CConcHolder & | Holder, |
const string & | Query, | ||
vector< size_t >::const_iterator | start, | ||
vector< size_t >::const_iterator | end | ||
) |
store a result for Query in the cache
Holder | session object / result set to store |
Query | query string (cache key) to be stored |
start | hit-index iterator wrt Holder.m_Hits[] of first hit to be stored |
end | hit-index iterator wrt Holder.m_Hits[] of first hit NOT to store |
References CACHEDEBUGLOG, Format(), jsonStr(), ddcLockable::lock(), CQueryResult::m_AllHitsCount, CQueryResult::m_bSortByString, CQueryResult::m_DebugInfo, CQueryResult::m_HighlightIds, CQueryResult::m_HighlightOccurs, CQueryResult::m_Hits, CConcordance::m_MaxCachedHitsCount, CConcordance::m_MaxQueryCacheSize, CConcSession::m_pConcordance, m_Queries, m_QueryCache, CQueryResult::m_RelevantDocumentCount, CQueryResult::m_SortOrder, and ddcLockable::unlock().
Referenced by ~CConcSessionContext().
void CConcSessionContext::CacheClear | ( | ) |
clear the query cache; implicitly handles locking
References ClearContainer(), ddcLockable::lock(), m_Queries, m_QueryCache, TrimHeap(), and ddcLockable::unlock().
Referenced by ~CConcSessionContext().
size_t CConcSessionContext::CacheSize | ( | void | ) |
get current cache size; implicitly handles locking
References ddcLockable::lock(), m_QueryCache, and ddcLockable::unlock().
Referenced by ~CConcSessionContext().
map<string, CQueryResult> CConcSessionContext::m_QueryCache |
hit results for the last MaxQueryCacheSize queries
Referenced by CacheClear(), CacheGet(), CacheSet(), and CacheSize().
deque<string> CConcSessionContext::m_Queries |
a deque for last MaxQueryCacheSize queries; m_Queries.last() is the last given query
Referenced by CacheClear(), CacheGet(), and CacheSet().