Class UTF8TaxonomyWriterCache
- java.lang.Object
-
- org.apache.lucene.facet.taxonomy.writercache.UTF8TaxonomyWriterCache
-
- All Implemented Interfaces:
TaxonomyWriterCache,Accountable
@Deprecated public final class UTF8TaxonomyWriterCache extends Object implements TaxonomyWriterCache, Accountable
Deprecated.UseLruTaxonomyWriterCacheinstead.A "cache" that never frees memory, and stores labels in a BytesRefHash (utf-8 encoding).
-
-
Field Summary
-
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
-
Constructor Summary
Constructors Constructor Description UTF8TaxonomyWriterCache()Deprecated.Sole constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclear()Deprecated.Clears the content of the cache.voidclose()Deprecated.Let go of whatever resources the cache is holding.intget(FacetLabel label)Deprecated.Lookup a category in the cache, returning its ordinal, or a negative number if the category is not in the cache.booleanisFull()Deprecated.Returns true if the cache is full, such that the nextTaxonomyWriterCache.put(org.apache.lucene.facet.taxonomy.FacetLabel, int)will evict entries from it, false otherwise.booleanput(FacetLabel label, int ord)Deprecated.Add a category to the cache, with the given ordinal as the value.longramBytesUsed()Deprecated.intsize()Deprecated.How many labels are currently stored in the cache.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.lucene.util.Accountable
getChildResources
-
-
-
-
Method Detail
-
get
public int get(FacetLabel label)
Deprecated.Description copied from interface:TaxonomyWriterCacheLookup a category in the cache, returning its ordinal, or a negative number if the category is not in the cache.It is up to the caller to remember what a negative response means: If the caller knows the cache is complete (it was initially fed with all the categories, and since then put() never returned true) it means the category does not exist. Otherwise, the category might still exist, but just be missing from the cache.
- Specified by:
getin interfaceTaxonomyWriterCache
-
put
public boolean put(FacetLabel label, int ord)
Deprecated.Description copied from interface:TaxonomyWriterCacheAdd a category to the cache, with the given ordinal as the value.If the implementation keeps only a partial cache (e.g., an LRU cache) and finds that its cache is full, it should clear up part of the cache and return
true. Otherwise, it should returnfalse.The reason why the caller needs to know if part of the cache was cleared is that in that case it will have to commit its on-disk index (so that all the latest category additions can be searched on disk, if we can't rely on the cache to contain them).
Ordinals should be non-negative. Currently there is no defined way to specify that a cache should remember a category does NOT exist. It doesn't really matter, because normally the next thing we do after finding that a category does not exist is to add it.
- Specified by:
putin interfaceTaxonomyWriterCache
-
isFull
public boolean isFull()
Deprecated.Description copied from interface:TaxonomyWriterCacheReturns true if the cache is full, such that the nextTaxonomyWriterCache.put(org.apache.lucene.facet.taxonomy.FacetLabel, int)will evict entries from it, false otherwise.- Specified by:
isFullin interfaceTaxonomyWriterCache
-
clear
public void clear()
Deprecated.Description copied from interface:TaxonomyWriterCacheClears the content of the cache. UnlikeTaxonomyWriterCache.close(), the caller can assume that the cache is still operable after this method returns.- Specified by:
clearin interfaceTaxonomyWriterCache
-
size
public int size()
Deprecated.How many labels are currently stored in the cache.- Specified by:
sizein interfaceTaxonomyWriterCache
-
ramBytesUsed
public long ramBytesUsed()
Deprecated.- Specified by:
ramBytesUsedin interfaceAccountable
-
close
public void close()
Deprecated.Description copied from interface:TaxonomyWriterCacheLet go of whatever resources the cache is holding. After a close(), this object can no longer be used.- Specified by:
closein interfaceTaxonomyWriterCache
-
-