@ThreadSafe public class RemoteCacheStore extends AbstractCacheStore
RemoteCacheStoreConfig,
Hotrod Java ClientmultiThreadedPurge, purgerServicecache, marshaller| Constructor and Description |
|---|
RemoteCacheStore() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears all entries in the store
|
boolean |
containsKey(Object key)
This implementation delegates to
CacheLoader.load(Object), to ensure that a response is
returned only if the entry is not expired. |
void |
fromStream(ObjectInput inputStream)
Writes contents of the stream to the store.
|
Class<? extends CacheLoaderConfig> |
getConfigurationClass()
This method is used by the configuration parser to get a hold of the CacheLoader implementation's corresponding
CacheLoaderConfig type. |
RemoteCache<Object,Object> |
getRemoteCache() |
void |
init(CacheLoaderConfig config,
Cache<?,?> cache,
StreamingMarshaller m)
Used to initialize a cache loader.
|
Set<InternalCacheEntry> |
load(int numEntries)
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<Object> keysToExclude)
Loads a set of all keys, excluding a filter set.
|
protected void |
purgeInternal() |
boolean |
remove(Object key)
Removes an entry in the store.
|
void |
setInternalCacheEntryFactory(InternalEntryFactory iceFactory) |
void |
start() |
void |
stop() |
void |
store(InternalCacheEntry entry)
Stores an entry
|
void |
toStream(ObjectOutput outputStream)
Loads the entire state into a stream, using whichever format is most efficient for the cache loader
implementation.
|
applyModifications, commit, getCacheStoreConfig, getConcurrencyLevel, getMarshaller, prepare, purgeExpired, removeAll, rollback, safeClose, safeClose, supportsMultiThreadedPurgepublic InternalCacheEntry load(Object key) throws CacheLoaderException
CacheLoaderkey - keyCacheLoaderException - in the event of problems reading from sourceprotected void purgeInternal()
throws CacheLoaderException
purgeInternal in class AbstractCacheStoreCacheLoaderExceptionpublic boolean containsKey(Object key) throws CacheLoaderException
AbstractCacheLoaderCacheLoader.load(Object), to ensure that a response is
returned only if the entry is not expired.containsKey in interface CacheLoadercontainsKey in class AbstractCacheLoaderkey - key to testCacheLoaderException - in the event of problems reading from sourcepublic void store(InternalCacheEntry entry) throws CacheLoaderException
CacheStoreentry - entry to storeCacheLoaderException - in the event of problems writing to the storepublic void fromStream(ObjectInput inputStream) throws CacheLoaderException
CacheStoreCacheStore.toStream(java.io.ObjectOutput). While not a
requirement, it is recommended that implementations make use of the StreamingMarshaller
when dealing with the stream to make use of efficient marshalling.
It is imperative that implementations do not close the stream after finishing with it.
It is also recommended that implementations use their own start and end markers on the stream since
other processes may write additional data to the stream after the cache store has written to it. As such, either
markers or some other mechanism to prevent the store from reading too much information should be employed when
writing to the stream in CacheStore.fromStream(java.io.ObjectInput) to prevent data corruption.
It can be assumed that the stream passed in already performs buffering such that the cache store implementation
doesn't have to.
inputStream - stream to read fromCacheLoaderException - in the event of problems writing to the storepublic void toStream(ObjectOutput outputStream) throws CacheLoaderException
CacheStoreCacheStore.fromStream(java.io.ObjectInput).
While not a requirement, it is recommended that implementations make use of the StreamingMarshaller when dealing with the stream to make use of efficient marshalling.
It is imperative that implementations do not flush or close the stream after finishing with it.
It is also recommended that implementations use their own start and end markers on the stream since
other processes may write additional data to the stream after the cache store has written to it. As such, either
markers or some other mechanism to prevent the store from reading too much information in CacheStore.fromStream(java.io.ObjectInput) should be employed, to prevent data corruption.
It can be assumed that the stream passed in already performs buffering such that the cache store implementation
doesn't have to.
outputStream - stream to write toCacheLoaderException - in the event of problems reading from the storepublic void clear()
throws CacheLoaderException
CacheStoreCacheLoaderException - in the event of problems writing to the storepublic boolean remove(Object key) throws CacheLoaderException
CacheStorekey - key to removeCacheLoaderException - in the event of problems writing to the storepublic Set<InternalCacheEntry> loadAll() throws CacheLoaderException
CacheLoaderCacheLoaderException - in the event of problems reading from sourcepublic Set<InternalCacheEntry> load(int numEntries) throws CacheLoaderException
CacheLoadernumEntries - maximum number of entries to loadCacheLoaderExceptionpublic Set<Object> loadAllKeys(Set<Object> keysToExclude) throws CacheLoaderException
CacheLoaderkeysToExclude - a set of keys to exclude. An empty set or null will indicate that all keys should be returned.CacheLoaderExceptionpublic void init(CacheLoaderConfig config, Cache<?,?> cache, StreamingMarshaller m) throws CacheLoaderException
CacheLoaderCacheLoaderManager
when setting up cache loaders.init in interface CacheLoaderinit in class AbstractCacheStoreconfig - 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.CacheLoaderExceptionpublic void start()
throws CacheLoaderException
start in interface CacheLoaderstart in class AbstractCacheStoreCacheLoaderExceptionpublic void stop()
throws CacheLoaderException
stop in interface CacheLoaderstop in class AbstractCacheStoreCacheLoaderExceptionpublic Class<? extends CacheLoaderConfig> getConfigurationClass()
CacheLoaderCacheLoaderConfig 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.
CacheLoaderConfig bean used to configure this
implementation of CacheLoader.public void setInternalCacheEntryFactory(InternalEntryFactory iceFactory)
public RemoteCache<Object,Object> getRemoteCache()
Copyright © 2017 JBoss, a division of Red Hat. All Rights Reserved.