Lucene++ - a full-featured, c++ search engine
API Documentation
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>
Public Member Functions | |
FilterManager () | |
Sets up the FilterManager singleton. More... | |
virtual | ~FilterManager () |
virtual String | getClassName () |
boost::shared_ptr< FilterManager > | shared_from_this () |
virtual void | initialize () |
Called directly after instantiation to create objects that depend on this object being fully constructed. More... | |
void | setCacheSize (int32_t cacheCleanSize) |
Sets the max size that cache should reach before it is cleaned up. More... | |
void | setCleanThreadSleepTime (int64_t cleanSleepTime) |
Sets the cache cleaning frequency in milliseconds. More... | |
FilterPtr | getFilter (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. More... | |
![]() | |
virtual | ~LuceneObject () |
virtual LuceneObjectPtr | clone (LuceneObjectPtr other=LuceneObjectPtr()) |
Return clone of this object. More... | |
virtual int32_t | hashCode () |
Return hash code for this object. More... | |
virtual bool | equals (LuceneObjectPtr other) |
Return whether two objects are equal. More... | |
virtual int32_t | compareTo (LuceneObjectPtr other) |
Compare two objects. More... | |
virtual String | toString () |
Returns a string representation of the object. More... | |
![]() | |
virtual | ~LuceneSync () |
virtual SynchronizePtr | getSync () |
Return this object synchronize lock. More... | |
virtual LuceneSignalPtr | getSignal () |
Return this object signal. More... | |
virtual void | lock (int32_t timeout=0) |
Lock this object using an optional timeout. More... | |
virtual void | unlock () |
Unlock this object. More... | |
virtual bool | holdsLock () |
Returns true if this object is currently locked by current thread. More... | |
virtual void | wait (int32_t timeout=0) |
Wait for signal using an optional timeout. More... | |
virtual void | notifyAll () |
Notify all threads waiting for signal. More... | |
Static Public Member Functions | |
static String | _getClassName () |
static FilterManagerPtr | getInstance () |
Protected Attributes | |
MapIntFilterItem | cache |
The cache itself. More... | |
int32_t | cacheCleanSize |
Maximum allowed cache size. More... | |
int64_t | cleanSleepTime |
Cache cleaning frequency. More... | |
FilterCleanerPtr | filterCleaner |
Cache cleaner that runs in a separate thread. More... | |
Static Protected Attributes | |
static const int32_t | DEFAULT_CACHE_CLEAN_SIZE |
The default maximum number of Filters in the cache. More... | |
static const int64_t | DEFAULT_CACHE_SLEEP_TIME |
The default frequency of cache cleanup. More... | |
Additional Inherited Members | |
![]() | |
LuceneObject () | |
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.
Lucene::FilterManager::FilterManager | ( | ) |
Sets up the FilterManager singleton.
|
virtual |
|
inlinestatic |
|
inlinevirtual |
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.
filter | The input filter |
|
static |
|
virtual |
Called directly after instantiation to create objects that depend on this object being fully constructed.
Reimplemented from Lucene::LuceneObject.
void Lucene::FilterManager::setCacheSize | ( | int32_t | cacheCleanSize) |
Sets the max size that cache should reach before it is cleaned up.
cacheCleanSize | maximum allowed cache size |
void Lucene::FilterManager::setCleanThreadSleepTime | ( | int64_t | cleanSleepTime) |
Sets the cache cleaning frequency in milliseconds.
cleanSleepTime | cleaning frequency in milliseconds |
|
inline |
|
protected |
The cache itself.
|
protected |
Maximum allowed cache size.
|
protected |
Cache cleaning frequency.
|
staticprotected |
The default maximum number of Filters in the cache.
|
staticprotected |
The default frequency of cache cleanup.
|
protected |
Cache cleaner that runs in a separate thread.