org.apache.lucene.search
Class FilterManager
- java.lang.Object
-
- org.apache.lucene.search.FilterManager
-
public class FilterManager extends java.lang.ObjectFilter caching singleton. It can be used byRemoteCachingWrapperFilteror 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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description FiltergetFilter(Filter filter)Returns the cached version of the filter.static FilterManagergetInstance()voidsetCacheSize(int cacheCleanSize)Sets the max size that cache should reach before it is cleaned upvoidsetCleanThreadSleepTime(long cleanSleepTime)Sets the cache cleaning frequency in milliseconds.
-
-
-
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
-
-
DataMelt 3.0 © DataMelt by jWork.ORG