Class UTF8TaxonomyWriterCache
- All Implemented Interfaces:
TaxonomyWriterCache
,Accountable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ThreadLocal
<BytesRefBuilder> Deprecated.private final Counter
Deprecated.private int
Deprecated.private static final byte
Deprecated.private final BytesRefHash
Deprecated.private int[][]
Deprecated.private static final int
Deprecated.private static final int
Deprecated.private static final int
Deprecated.private int
Deprecated.Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
assertSameOrdinal
(FacetLabel label, int id, int ord) Deprecated.void
clear()
Deprecated.Clears the content of the cache.void
close()
Deprecated.Let go of whatever resources the cache is holding.int
get
(FacetLabel label) Deprecated.Lookup a category in the cache, returning its ordinal, or a negative number if the category is not in the cache.boolean
isFull()
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.boolean
put
(FacetLabel label, int ord) Deprecated.Add a category to the cache, with the given ordinal as the value.long
Deprecated.Return the memory usage of this object in bytes.int
size()
Deprecated.How many labels are currently stored in the cache.private BytesRef
toBytes
(FacetLabel label) Deprecated.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
-
Field Details
-
bytes
Deprecated. -
bytesUsed
Deprecated. -
map
Deprecated. -
PAGE_BITS
private static final int PAGE_BITSDeprecated.- See Also:
-
PAGE_SIZE
private static final int PAGE_SIZEDeprecated.- See Also:
-
PAGE_MASK
private static final int PAGE_MASKDeprecated.- See Also:
-
ordinals
private volatile int[][] ordinalsDeprecated. -
count
private int countDeprecated. -
pageCount
private int pageCountDeprecated. -
DELIM_CHAR
private static final byte DELIM_CHARDeprecated.- See Also:
-
-
Constructor Details
-
UTF8TaxonomyWriterCache
public UTF8TaxonomyWriterCache()Deprecated.Sole constructor.
-
-
Method Details
-
get
Deprecated.Description copied from interface:TaxonomyWriterCache
Lookup 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:
get
in interfaceTaxonomyWriterCache
-
assertSameOrdinal
Deprecated. -
put
Deprecated.Description copied from interface:TaxonomyWriterCache
Add 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:
put
in interfaceTaxonomyWriterCache
-
isFull
public boolean isFull()Deprecated.Description copied from interface:TaxonomyWriterCache
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.- Specified by:
isFull
in interfaceTaxonomyWriterCache
-
clear
public void clear()Deprecated.Description copied from interface:TaxonomyWriterCache
Clears the content of the cache. UnlikeTaxonomyWriterCache.close()
, the caller can assume that the cache is still operable after this method returns.- Specified by:
clear
in interfaceTaxonomyWriterCache
-
size
public int size()Deprecated.How many labels are currently stored in the cache.- Specified by:
size
in interfaceTaxonomyWriterCache
-
ramBytesUsed
public long ramBytesUsed()Deprecated.Description copied from interface:Accountable
Return the memory usage of this object in bytes. Negative values are illegal.- Specified by:
ramBytesUsed
in interfaceAccountable
-
close
public void close()Deprecated.Description copied from interface:TaxonomyWriterCache
Let go of whatever resources the cache is holding. After a close(), this object can no longer be used.- Specified by:
close
in interfaceTaxonomyWriterCache
-
toBytes
Deprecated.
-
LruTaxonomyWriterCache
instead.