ddc
Public Attributes | List of all members
CConcSessionContext Class Reference

common session data, sharable by multiple worker threads extracted from ddc-2.0.x CConcHolder; now CConcSession More...

#include <ConcSessionContext.h>

Inheritance diagram for CConcSessionContext:
Inheritance graph
[legend]
Collaboration diagram for CConcSessionContext:
Collaboration graph
[legend]

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, CQueryResultm_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
 

Detailed Description

common session data, sharable by multiple worker threads extracted from ddc-2.0.x CConcHolder; now CConcSession

Constructor & Destructor Documentation

◆ CConcSessionContext()

CConcSessionContext::CConcSessionContext ( )
inline

default constructor

◆ ~CConcSessionContext()

CConcSessionContext::~CConcSessionContext ( )
inline

default destructor

References CacheClear(), CacheGet(), CacheSet(), and CacheSize().

Here is the call graph for this function:

Member Function Documentation

◆ CacheGet()

bool CConcSessionContext::CacheGet ( CConcHolder Holder,
const string &  Query,
DWORD EndHitNo 
)

fetch cached result for Query if available

  • formerly CConcHolder::TryToGetFromCache()
  • implicitly handles locking
    Parameters
    Holdersession object / result set to populate
    Queryquery string (cache key) to be fetched
    EndHitNoon call, index of first hit to retrieve; on return index of last hit retrieved
    Returns
    true on success, otherwise false

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CacheSet()

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

  • formerly CConcHolder::SaveToCache()
  • implicitly handles locking
    Parameters
    Holdersession object / result set to store
    Queryquery string (cache key) to be stored
    starthit-index iterator wrt Holder.m_Hits[] of first hit to be stored
    endhit-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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CacheClear()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CacheSize()

size_t CConcSessionContext::CacheSize ( void  )

get current cache size; implicitly handles locking

References ddcLockable::lock(), m_QueryCache, and ddcLockable::unlock().

Referenced by ~CConcSessionContext().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_QueryCache

map<string, CQueryResult> CConcSessionContext::m_QueryCache

hit results for the last MaxQueryCacheSize queries

Referenced by CacheClear(), CacheGet(), CacheSet(), and CacheSize().

◆ m_Queries

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().


The documentation for this class was generated from the following files: