FilterManager (Lucene 2.4.1 API)
Keywords: org.apache.lucene.search.FilterManager class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.search
Class FilterManager

    java.lang.Object
      org.apache.lucene.search.FilterManager

    public class FilterManager

extends Object

Filter caching singleton. It can be used by `RemoteCachingWrapperFilter` or just to save filters locally for reuse. This class makes it possble to cache Filters even when using RMI, as it keeps the cache on the seaercher side of the RMI connection. 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.

Nested Class Summary
`protected class` | `FilterManager.FilterCleaner` Keeps the cache from getting too big.
`protected class` | `FilterManager.FilterItem` Holds the filter and the last time the filter was used, to make LRU-based cache cleaning possible.

Field Summary
`protected Map` | `cache` The cache itself
`protected int` | `cacheCleanSize` Maximum allowed cache size
`protected long` | `cleanSleepTime` Cache cleaning frequency
`protected static int` | `DEFAULT_CACHE_CLEAN_SIZE` The default maximum number of Filters in the cache
`protected static long` | `DEFAULT_CACHE_SLEEP_TIME` The default frequency of cache clenup
`protected FilterManager.FilterCleaner` | `filterCleaner` Cache cleaner that runs in a separate thread
`protected static FilterManager` | `manager`

Constructor Summary
`protected` | `FilterManager()` Sets up the FilterManager singleton.

Method Summary
`Filter` | `getFilter(Filter filter)` Returns the cached version of the filter.
`static FilterManager` | `getInstance()`
`void` | `setCacheSize(int cacheCleanSize)` Sets the max size that cache should reach before it is cleaned up
`void` | `setCleanThreadSleepTime(long cleanSleepTime)` Sets the cache cleaning frequency in milliseconds.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### manager

    protected static FilterManager manager

### DEFAULT_CACHE_CLEAN_SIZE

    protected static final int DEFAULT_CACHE_CLEAN_SIZE

  The default maximum number of Filters in the cache

  See Also:
    Constant Field Values

### DEFAULT_CACHE_SLEEP_TIME

    protected static final long DEFAULT_CACHE_SLEEP_TIME

  The default frequency of cache clenup

  See Also:
    Constant Field Values

### cache

    protected Map cache

  The cache itself

### cacheCleanSize

    protected int cacheCleanSize

  Maximum allowed cache size

### cleanSleepTime

    protected long cleanSleepTime

  Cache cleaning frequency

### filterCleaner

    protected FilterManager.FilterCleaner filterCleaner

  Cache cleaner that runs in a separate thread

Constructor Detail

### FilterManager

    protected FilterManager()

  Sets up the FilterManager singleton.

Method Detail

### getInstance

    public static FilterManager getInstance()

### setCacheSize

    public void setCacheSize(int cacheCleanSize)

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

  Parameters:
    `cacheCleanSize` - maximum allowed cache size

### setCleanThreadSleepTime

    public void setCleanThreadSleepTime(long cleanSleepTime)

  Sets the cache cleaning frequency in milliseconds.

  Parameters:
    `cleanSleepTime` - cleaning frequency in millioseconds

### getFilter

    public Filter getFilter(Filter 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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2009 Apache Software Foundation. All Rights Reserved.