JODA  0.13.1 (59b41972)
JSON On-Demand Analysis
Public Member Functions | Protected Attributes
QueryCache Class Reference

#include <QueryCache.h>

Collaboration diagram for QueryCache:
[legend]

Public Member Functions

std::shared_ptr< const CacheEntry::CacheIndexgetBestCache (const std::shared_ptr< joda::query::Predicate > &pred)
 
std::shared_ptr< const CacheEntry::CacheIndexgetBestCache (const std::unique_ptr< joda::query::Predicate > &pred)
 
std::shared_ptr< const CacheEntry::CacheIndexgetBestCache (const std::string &predStr)
 
bool cacheAvailable (const std::shared_ptr< joda::query::Predicate > &pred)
 
bool cacheAvailable (const std::string &predStr)
 
void addQueryResult (std::unique_ptr< CacheEntry > &&ce)
 
void addQueryResult (std::shared_ptr< const CacheEntry::CacheIndex > docs, const std::shared_ptr< joda::query::Predicate > &predicate)
 
void reset ()
 

Protected Attributes

std::unordered_map< std::string, std::unique_ptr< CacheEntry > > queryMap
 

Detailed Description

This class is responsible for managing a cache for previously exectuted queries.

Member Function Documentation

◆ addQueryResult() [1/2]

void QueryCache::addQueryResult ( std::shared_ptr< const CacheEntry::CacheIndex docs,
const std::shared_ptr< joda::query::Predicate > &  predicate 
)

Creates and adds an CacheEntry to the QueryCache

Parameters
docsThe set of DOC_IDs to add to the CacheEntry
predicateThe predicate that produced docs
Here is the call graph for this function:

◆ addQueryResult() [2/2]

void QueryCache::addQueryResult ( std::unique_ptr< CacheEntry > &&  ce)

Adds an already created CacheEntry

Parameters
ceCacheEntry to insert to the QueryCache
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cacheAvailable() [1/2]

bool QueryCache::cacheAvailable ( const std::shared_ptr< joda::query::Predicate > &  pred)

Checks if the given predicate is stored in the cache

Parameters
predPredicate to check for
Returns
True if a cache exists; False else
Here is the call graph for this function:

◆ cacheAvailable() [2/2]

bool QueryCache::cacheAvailable ( const std::string &  predStr)

Checks if the given predicate is stored in the cache

Parameters
predStrPredicate to check for
Returns
True if a cache exists; False else

◆ getBestCache() [1/3]

std::shared_ptr< const CacheEntry::CacheIndex > QueryCache::getBestCache ( const std::shared_ptr< joda::query::Predicate > &  pred)

Returns the cached DOC_IDs for the given predicate

Parameters
predThe predicated in internal representation
Returns
A set of DOC_IDs stored by a previous query execution
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBestCache() [2/3]

std::shared_ptr< const CacheEntry::CacheIndex > QueryCache::getBestCache ( const std::string &  predStr)

Returns the cached DOC_IDs for the given predicate

Parameters
predStrThe predicated in string representation
Returns
A set of DOC_IDs stored by a previous query execution

◆ getBestCache() [3/3]

std::shared_ptr< const CacheEntry::CacheIndex > QueryCache::getBestCache ( const std::unique_ptr< joda::query::Predicate > &  pred)

Returns the cached DOC_IDs for the given predicate

Parameters
predThe predicated in internal representation
Returns
A set of DOC_IDs stored by a previous query execution
Here is the call graph for this function:

◆ reset()

void QueryCache::reset ( )

Resets the QueryCache and removes all CacheEntries

Field Documentation

◆ queryMap

std::unordered_map<std::string, std::unique_ptr<CacheEntry> > QueryCache::queryMap
protected

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