public class LuceneCacheLoader extends Object implements CacheLoader
InfinispanDirectory
, 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.Constructor and Description |
---|
LuceneCacheLoader() |
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(Object key) |
Class<? extends CacheLoaderConfig> |
getConfigurationClass()
This method is used by the configuration parser to get a hold of the CacheLoader implementation's corresponding
CacheLoaderConfig type. |
void |
init(CacheLoaderConfig config,
Cache<?,?> cache,
StreamingMarshaller m)
Used to initialize a cache loader.
|
Set<InternalCacheEntry> |
load(int maxEntries)
Loads up to a specific number of entries.
|
InternalCacheEntry |
load(Object key)
Loads an entry mapped to by a given key.
|
Set<InternalCacheEntry> |
loadAll()
Loads all entries in the loader.
|
Set<Object> |
loadAllKeys(Set keysToExclude)
Loads a set of all keys, excluding a filter set.
|
void |
start() |
void |
stop() |
public void init(CacheLoaderConfig config, Cache<?,?> cache, StreamingMarshaller m) throws CacheLoaderException
CacheLoader
CacheLoaderManager
when setting up cache loaders.init
in interface CacheLoader
config
- the cache loader configuration beancache
- cache associated with this cache loader. Implementations may use this to determine cache name when
selecting where refer to state in storage, for example, a different database table name.m
- marshaller to use when loading state from a stream, if supported by the implementation.CacheLoaderException
public InternalCacheEntry load(Object key) throws CacheLoaderException
CacheLoader
load
in interface CacheLoader
key
- keyCacheLoaderException
- in the event of problems reading from sourcepublic boolean containsKey(Object key) throws CacheLoaderException
containsKey
in interface CacheLoader
key
- key to testCacheLoaderException
- in the event of problems reading from sourcepublic Set<InternalCacheEntry> loadAll() throws CacheLoaderException
CacheLoader
loadAll
in interface CacheLoader
CacheLoaderException
- in the event of problems reading from sourcepublic Set<InternalCacheEntry> load(int maxEntries) throws CacheLoaderException
load
in interface CacheLoader
maxEntries
- maximum number of entries to loadCacheLoaderException
public Set<Object> loadAllKeys(Set keysToExclude) throws CacheLoaderException
CacheLoader
loadAllKeys
in interface CacheLoader
keysToExclude
- a set of keys to exclude. An empty set or null will indicate that all keys should be returned.CacheLoaderException
public void start() throws CacheLoaderException
start
in interface CacheLoader
CacheLoaderException
public void stop() throws CacheLoaderException
stop
in interface CacheLoader
CacheLoaderException
public Class<? extends CacheLoaderConfig> getConfigurationClass()
CacheLoader
CacheLoaderConfig
type. This is usually done by instantiating the CacheLoader
and then calling this method. This may result in 2 instances being created, however, since the instance
created to get a hold of the configuration type is then discarded and another instance is created for actual
use as a CacheLoader when the cache starts.
Since Infinispan 4.1, you can also annotate your CacheLoader implementation with CacheLoaderMetadata
and provide this information via the annotation, which will prevent unnecessary instances being created.
getConfigurationClass
in interface CacheLoader
CacheLoaderConfig
bean used to configure this
implementation of CacheLoader
.Copyright © 2017 JBoss, a division of Red Hat. All Rights Reserved.