java.lang.Object | |
↳ | org.apache.lucene.search.FilterManager |
Filter caching singleton. It can be used to save filters locally for reuse. This class makes it possible to cache Filters even when using RMI, as it keeps the cache on the searcher 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 Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
FilterManager.FilterCleaner | Keeps the cache from getting too big. | ||||||||||
FilterManager.FilterItem | Holds the filter and the last time the filter was used, to make LRU-based cache cleaning possible. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | DEFAULT_CACHE_CLEAN_SIZE | The default maximum number of Filters in the cache | |||||||||
long | DEFAULT_CACHE_SLEEP_TIME | The default frequency of cache cleanup |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
cache | The cache itself | ||||||||||
cacheCleanSize | Maximum allowed cache size | ||||||||||
cleanSleepTime | Cache cleaning frequency | ||||||||||
filterCleaner | Cache cleaner that runs in a separate thread | ||||||||||
manager |
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Sets up the FilterManager singleton.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the cached version of the filter.
| |||||||||||
Sets the max size that cache should reach before it is cleaned up
| |||||||||||
Sets the cache cleaning frequency in milliseconds.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
The default maximum number of Filters in the cache
The default frequency of cache cleanup
Maximum allowed cache size
Cache cleaning frequency
Sets up the FilterManager singleton.
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 |
---|
Sets the max size that cache should reach before it is cleaned up
cacheCleanSize | maximum allowed cache size |
---|
Sets the cache cleaning frequency in milliseconds.
cleanSleepTime | cleaning frequency in milliseconds |
---|