org.apache.lucene.index
Class DocValues.SourceCache

java.lang.Object
  extended by org.apache.lucene.index.DocValues.SourceCache
Direct Known Subclasses:
DocValues.SourceCache.DirectSourceCache
Enclosing class:
DocValues

public abstract static class DocValues.SourceCache
extends Object

Abstract base class for DocValues DocValues.Source cache.

DocValues.Source instances loaded via DocValues.load() are entirely memory resident and need to be maintained by the caller. Each call to DocValues.load() 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.DirectSourceCache 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.

See Also:
DocValues.setCache(SourceCache), DocValues.getSource()
WARNING: This API is experimental and might change in incompatible ways in the next release.

Nested Class Summary
static class DocValues.SourceCache.DirectSourceCache
          Simple per DocValues instance cache implementation that holds a DocValues.Source a member variable.
 
Constructor Summary
protected DocValues.SourceCache()
          Sole constructor.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocValues.SourceCache

protected DocValues.SourceCache()
Sole constructor. (For invocation by subclass constructors, typically implicit.)

Method Detail

load

public abstract DocValues.Source load(DocValues values)
                               throws IOException
Atomically loads a 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

Throws:
IOException

invalidate

public abstract void invalidate(DocValues values)
Atomically invalidates the cached DocValues.Source instances if any and empties the cache.


close

public void close(DocValues values)
Atomically closes the cache and frees all resources.



Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.