Class LuceneCacheLoader<K,V>
- java.lang.Object
-
- org.infinispan.lucene.cacheloader.LuceneCacheLoader<K,V>
-
- All Implemented Interfaces:
Lifecycle
,AdvancedCacheLoader<K,V>
,CacheLoader<K,V>
public class LuceneCacheLoader<K,V> extends Object implements AdvancedCacheLoader<K,V>
A CacheLoader meant to load Lucene index(es) from filesystem based Lucene index(es). This is exclusively suitable for keys being used by the Directory, any other key will be ignored. The InfinispanDirectory requires indexes to be named; this CacheLoader needs to be configured with the path of the root directory containing the indexes, and expects index names to match directory names under this common root path.- Since:
- 5.2
- Author:
- Sanne Grinovero
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.infinispan.persistence.spi.AdvancedCacheLoader
AdvancedCacheLoader.CacheLoaderTask<K,V>, AdvancedCacheLoader.TaskContext
-
-
Constructor Summary
Constructors Constructor Description LuceneCacheLoader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(Object key)
Returns true if the storage contains an entry associated with the given key.void
init(InitializationContext ctx)
Used to initialize a cache loader.MarshalledEntry
load(Object key)
Fetches an entry from the storage.org.reactivestreams.Publisher<MarshalledEntry<K,V>>
publishEntries(Predicate<? super K> filter, boolean fetchValue, boolean fetchMetadata)
Publishes all entries from this store.int
size()
Returns the number of elements in the store.void
start()
Invoked on component startvoid
stop()
Invoked on component stop-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.infinispan.persistence.spi.AdvancedCacheLoader
process, publishKeys
-
Methods inherited from interface org.infinispan.persistence.spi.CacheLoader
isAvailable
-
-
-
-
Method Detail
-
init
public void init(InitializationContext ctx)
Description copied from interface:CacheLoader
Used to initialize a cache loader. Typically invoked by thePersistenceManager
when setting up cache loaders.- Specified by:
init
in interfaceCacheLoader<K,V>
-
load
public MarshalledEntry load(Object key)
Description copied from interface:CacheLoader
Fetches an entry from the storage. If aMarshalledEntry
needs to be created here,InitializationContext.getMarshalledEntryFactory()
andInitializationContext.getByteBufferFactory()
should be used.- Specified by:
load
in interfaceCacheLoader<K,V>
- Returns:
- the entry, or null if the entry does not exist
-
contains
public boolean contains(Object key)
Description copied from interface:CacheLoader
Returns true if the storage contains an entry associated with the given key.- Specified by:
contains
in interfaceCacheLoader<K,V>
-
publishEntries
public org.reactivestreams.Publisher<MarshalledEntry<K,V>> publishEntries(Predicate<? super K> filter, boolean fetchValue, boolean fetchMetadata)
Description copied from interface:AdvancedCacheLoader
Publishes all entries from this store. The given publisher can be used by as manySubscriber
s as desired. Entries are not retrieved until a given Subscriber requests them from theSubscription
.If fetchMetadata is true this store must guarantee to not return any expired entries.
- Specified by:
publishEntries
in interfaceAdvancedCacheLoader<K,V>
- Parameters:
filter
- a filter - null is treated as allowing all entriesfetchValue
- whether or not to fetch the value from the persistent store. E.g. if the iteration is intended only over the key set, no point fetching the values from the persistent store as wellfetchMetadata
- whether or not to fetch the metadata from the persistent store. E.g. if the iteration is intended only ove the key set, then no point fetching the metadata from the persistent store as well- Returns:
- a publisher that will provide the entries from the store
-
size
public int size()
Description copied from interface:AdvancedCacheLoader
Returns the number of elements in the store.- Specified by:
size
in interfaceAdvancedCacheLoader<K,V>
-
start
public void start()
Description copied from interface:Lifecycle
Invoked on component start
-
-