net.conquiris.lucene.search
Class GuavaCachingFilter

java.lang.Object
  extended by org.apache.lucene.search.Filter
      extended by net.conquiris.lucene.search.GuavaCachingFilter
All Implemented Interfaces:
Serializable

public final class GuavaCachingFilter
extends Filter

A wrapping filter based on Guava Cache. Uses a caching mode equivalent to Lucene's DeletesMode.RECACHE.

Author:
Andres Rodriguez
See Also:
Serialized Form

Constructor Summary
GuavaCachingFilter(Filter filter)
          Constructor with a maximum size of 100 elements and a expiration time of 10 minutes.
GuavaCachingFilter(Filter filter, int size, long duration, TimeUnit unit)
          Constructor.
 
Method Summary
 boolean equals(Object o)
           
 DocIdSet getDocIdSet(IndexReader reader)
           
 int hashCode()
           
 CacheStats stats()
          Returns a current snapshot of this cache's cumulative statistics.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GuavaCachingFilter

public GuavaCachingFilter(Filter filter,
                          int size,
                          long duration,
                          TimeUnit unit)
Constructor.

Parameters:
filter - Filter to cache results of.
size - the maximum size of the cache.
duration - the length of time after an entry is last accessed that it should be automatically removed.
unit - the unit that duration is expressed in
Throws:
IllegalArgumentException - if size is negative
IllegalArgumentException - if duration is negative

GuavaCachingFilter

public GuavaCachingFilter(Filter filter)
Constructor with a maximum size of 100 elements and a expiration time of 10 minutes.

Parameters:
filter - Filter to cache results of
Method Detail

getDocIdSet

public DocIdSet getDocIdSet(IndexReader reader)
                     throws IOException
Specified by:
getDocIdSet in class Filter
Throws:
IOException

stats

public CacheStats stats()
Returns a current snapshot of this cache's cumulative statistics.


toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2012 Derquinse Projects.. All Rights Reserved.