Lucene++ - a full-featured, c++ search engine
API Documentation


Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes
Lucene::FilterManager Class Reference

Filter caching singleton. It can be used to save filters locally for reuse. Also could be used as a persistent storage for any filter as long as the filter provides a proper hashCode(), as that is used as the key in the cache. More...

#include <FilterManager.h>

+ Inheritance diagram for Lucene::FilterManager:

Public Member Functions

 FilterManager ()
 Sets up the FilterManager singleton.
 
virtual ~FilterManager ()
 
virtual String getClassName ()
 
boost::shared_ptr< FilterManagershared_from_this ()
 
virtual void initialize ()
 Called directly after instantiation to create objects that depend on this object being fully constructed.
 
void setCacheSize (int32_t cacheCleanSize)
 Sets the max size that cache should reach before it is cleaned up.
 
void setCleanThreadSleepTime (int64_t cleanSleepTime)
 Sets the cache cleaning frequency in milliseconds.
 
FilterPtr getFilter (const FilterPtr &filter)
 Returns the cached version of the filter. Allows the caller to pass up a small filter but this will keep a persistent version around and allow the caching filter to do its job.
 
- Public Member Functions inherited from Lucene::LuceneObject
virtual ~LuceneObject ()
 
virtual LuceneObjectPtr clone (const LuceneObjectPtr &other=LuceneObjectPtr())
 Return clone of this object.
 
virtual int32_t hashCode ()
 Return hash code for this object.
 
virtual bool equals (const LuceneObjectPtr &other)
 Return whether two objects are equal.
 
virtual int32_t compareTo (const LuceneObjectPtr &other)
 Compare two objects.
 
virtual String toString ()
 Returns a string representation of the object.
 
- Public Member Functions inherited from Lucene::LuceneSync
virtual ~LuceneSync ()
 
virtual SynchronizePtr getSync ()
 Return this object synchronize lock.
 
virtual LuceneSignalPtr getSignal ()
 Return this object signal.
 
virtual void lock (int32_t timeout=0)
 Lock this object using an optional timeout.
 
virtual void unlock ()
 Unlock this object.
 
virtual bool holdsLock ()
 Returns true if this object is currently locked by current thread.
 
virtual void wait (int32_t timeout=0)
 Wait for signal using an optional timeout.
 
virtual void notifyAll ()
 Notify all threads waiting for signal.
 

Static Public Member Functions

static String _getClassName ()
 
static FilterManagerPtr getInstance ()
 

Protected Attributes

MapIntFilterItem cache
 The cache itself.
 
int32_t cacheCleanSize
 Maximum allowed cache size.
 
int64_t cleanSleepTime
 Cache cleaning frequency.
 
FilterCleanerPtr filterCleaner
 Cache cleaner that runs in a separate thread.
 
- Protected Attributes inherited from Lucene::LuceneSync
SynchronizePtr objectLock
 
LuceneSignalPtr objectSignal
 

Static Protected Attributes

static const int32_t DEFAULT_CACHE_CLEAN_SIZE
 The default maximum number of Filters in the cache.
 
static const int64_t DEFAULT_CACHE_SLEEP_TIME
 The default frequency of cache cleanup.
 

Additional Inherited Members

- Protected Member Functions inherited from Lucene::LuceneObject
 LuceneObject ()
 

Detailed Description

Filter caching singleton. It can be used to save filters locally for reuse. Also could be used as a persistent storage for any filter as long as the filter provides a proper hashCode(), as that is used as the key in the cache.

The cache is periodically cleaned up from a separate thread to ensure the cache doesn't exceed the maximum size.

Constructor & Destructor Documentation

◆ FilterManager()

Lucene::FilterManager::FilterManager ( )

Sets up the FilterManager singleton.

◆ ~FilterManager()

virtual Lucene::FilterManager::~FilterManager ( )
virtual

Member Function Documentation

◆ _getClassName()

static String Lucene::FilterManager::_getClassName ( )
inlinestatic

◆ getClassName()

virtual String Lucene::FilterManager::getClassName ( )
inlinevirtual

◆ getFilter()

FilterPtr Lucene::FilterManager::getFilter ( const FilterPtr filter)

Returns the cached version of the filter. Allows the caller to pass up a small filter but this will keep a persistent version around and allow the caching filter to do its job.

Parameters
filterThe input filter
Returns
The cached version of the filter

◆ getInstance()

static FilterManagerPtr Lucene::FilterManager::getInstance ( )
static

◆ initialize()

virtual void Lucene::FilterManager::initialize ( )
virtual

Called directly after instantiation to create objects that depend on this object being fully constructed.

Reimplemented from Lucene::LuceneObject.

◆ setCacheSize()

void Lucene::FilterManager::setCacheSize ( int32_t  cacheCleanSize)

Sets the max size that cache should reach before it is cleaned up.

Parameters
cacheCleanSizemaximum allowed cache size

◆ setCleanThreadSleepTime()

void Lucene::FilterManager::setCleanThreadSleepTime ( int64_t  cleanSleepTime)

Sets the cache cleaning frequency in milliseconds.

Parameters
cleanSleepTimecleaning frequency in milliseconds

◆ shared_from_this()

boost::shared_ptr< FilterManager > Lucene::FilterManager::shared_from_this ( )
inline

Field Documentation

◆ cache

MapIntFilterItem Lucene::FilterManager::cache
protected

The cache itself.

◆ cacheCleanSize

int32_t Lucene::FilterManager::cacheCleanSize
protected

Maximum allowed cache size.

◆ cleanSleepTime

int64_t Lucene::FilterManager::cleanSleepTime
protected

Cache cleaning frequency.

◆ DEFAULT_CACHE_CLEAN_SIZE

const int32_t Lucene::FilterManager::DEFAULT_CACHE_CLEAN_SIZE
staticprotected

The default maximum number of Filters in the cache.

◆ DEFAULT_CACHE_SLEEP_TIME

const int64_t Lucene::FilterManager::DEFAULT_CACHE_SLEEP_TIME
staticprotected

The default frequency of cache cleanup.

◆ filterCleaner

FilterCleanerPtr Lucene::FilterManager::filterCleaner
protected

Cache cleaner that runs in a separate thread.


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

clucene.sourceforge.net