public abstract static class DocValues.SourceCache extends Object
DocValues
DocValues.Source
cache.
DocValues.Source
instances loaded via DocValues.loadSource()
are entirely memory resident
and need to be maintained by the caller. Each call to
DocValues.loadSource()
will cause an entire reload of
the underlying data. Source instances obtained from
DocValues.getSource()
and DocValues.getSource()
respectively are maintained by a DocValues.SourceCache
that is closed (
close(DocValues)
) once the IndexReader
that created the
DocValues
instance is closed.
Unless DocValues.Source
instances are managed by another entity it is
recommended to use the cached variants to obtain a source instance.
Implementation of this API must be thread-safe.
DocValues.setCache(SourceCache)
,
DocValues.getSource()
Modifier and Type | Class and Description |
---|---|
static class |
DocValues.SourceCache.DirectSourceCache
Simple per
DocValues instance cache implementation that holds a
DocValues.Source a member variable. |
Modifier | Constructor and Description |
---|---|
protected |
DocValues.SourceCache()
Sole constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close(DocValues values)
Atomically closes the cache and frees all resources.
|
abstract void |
invalidate(DocValues values)
Atomically invalidates the cached
DocValues.Source
instances if any and empties the cache. |
abstract DocValues.Source |
load(DocValues values)
Atomically loads a
DocValues.Source into the cache from the given
DocValues and returns it iff no other DocValues.Source has already
been cached. |
abstract DocValues.Source |
loadDirect(DocValues values)
Atomically loads a
direct source into the per-thread cache from the given
DocValues and returns it iff no other direct source has already
been cached. |
protected DocValues.SourceCache()
public abstract DocValues.Source load(DocValues values) throws IOException
DocValues.Source
into the cache from the given
DocValues
and returns it iff no other DocValues.Source
has already
been cached. Otherwise the cached source is returned.
This method will not return null
IOException
public abstract DocValues.Source loadDirect(DocValues values) throws IOException
direct source
into the per-thread cache from the given
DocValues
and returns it iff no other direct source
has already
been cached. Otherwise the cached source is returned.
This method will not return null
IOException
public abstract void invalidate(DocValues values)
DocValues.Source
instances if any and empties the cache.public void close(DocValues values)
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.