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

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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. 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...
Public Member Functions inherited from Lucene::LuceneObject
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...
Public Member Functions inherited from Lucene::LuceneSync
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

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

Lucene::FilterManager::FilterManager | ( | ) |  |

Sets up the FilterManager singleton.

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

virtual

## Member Function Documentation

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

inline static

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

inline virtual

FilterPtr Lucene::FilterManager::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.

Parameters

  filter | The input filter

Returns
  The cached version of the filter

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

static

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.

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

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

Parameters

  cacheCleanSize | maximum allowed cache size

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

Sets the cache cleaning frequency in milliseconds.

Parameters

  cleanSleepTime | cleaning frequency in milliseconds

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

inline

## Field Documentation

MapIntFilterItem Lucene::FilterManager::cache

protected

The cache itself.

int32_t Lucene::FilterManager::cacheCleanSize

protected

Maximum allowed cache size.

int64_t Lucene::FilterManager::cleanSleepTime

protected

Cache cleaning frequency.

const int32_t Lucene::FilterManager::DEFAULT_CACHE_CLEAN_SIZE

static protected

The default maximum number of Filters in the cache.

const int64_t Lucene::FilterManager::DEFAULT_CACHE_SLEEP_TIME

static protected

The default frequency of cache cleanup.

FilterCleanerPtr Lucene::FilterManager::filterCleaner

protected

Cache cleaner that runs in a separate thread.

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

- FilterManager.h

clucene.sourceforge.net