|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface CacheStore
A specialization of the CacheLoader
interface that can be written to.
Method Summary | |
---|---|
void |
clear()
Clears all entries in the store |
void |
commit(GlobalTransaction tx)
Commits a transaction that has been previously prepared. |
void |
fromStream(ObjectInput inputStream)
Writes contents of the stream to the store. |
CacheStoreConfig |
getCacheStoreConfig()
Returns the configuration object associated to this cache store config. |
void |
prepare(List<? extends Modification> modifications,
GlobalTransaction tx,
boolean isOnePhase)
Issues a prepare call with a set of modifications to be applied to the cache store |
void |
purgeExpired()
Purges expired entries from the store. |
boolean |
remove(Object key)
Removes an entry in the store. |
void |
removeAll(Set<Object> keys)
Bulk remove operation |
void |
rollback(GlobalTransaction tx)
Rolls back a transaction that has been previously prepared This method may be invoked on a transaction for which there is no prior prepare(java.util.List, org.infinispan.transaction.xa.GlobalTransaction, boolean) . |
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. |
Methods inherited from interface org.infinispan.loaders.CacheLoader |
---|
containsKey, getConfigurationClass, init, load, load, loadAll, loadAllKeys, start, stop |
Method Detail |
---|
void store(InternalCacheEntry entry) throws CacheLoaderException
entry
- entry to store
CacheLoaderException
- in the event of problems writing to the storevoid fromStream(ObjectInput inputStream) throws CacheLoaderException
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 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 from
CacheLoaderException
- in the event of problems writing to the storevoid toStream(ObjectOutput outputStream) throws CacheLoaderException
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 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 to
CacheLoaderException
- in the event of problems reading from the storevoid clear() throws CacheLoaderException
CacheLoaderException
- in the event of problems writing to the storeboolean remove(Object key) throws CacheLoaderException
key
- key to remove
CacheLoaderException
- in the event of problems writing to the storevoid removeAll(Set<Object> keys) throws CacheLoaderException
keys
- to remove
CacheLoaderException
- in the event of problems writing to the storevoid purgeExpired() throws CacheLoaderException
CacheLoaderException
- in the event of problems writing to the storevoid prepare(List<? extends Modification> modifications, GlobalTransaction tx, boolean isOnePhase) throws CacheLoaderException
modifications
- modifications to be appliedtx
- transaction identifierisOnePhase
- if true, there will not be a commit or rollback phase and changes should be flushed
immediately
CacheLoaderException
- in the event of problems writing to the storevoid commit(GlobalTransaction tx) throws CacheLoaderException
prepare(java.util.List, org.infinispan.transaction.xa.GlobalTransaction, boolean)
. The implementation would
need to deal with this case accordingly. Typically, this would be a no-op, after ensuring any resources attached
to the transaction are cleared up.
Also note that this method may be invoked on a thread which is different from the prepare(java.util.List, org.infinispan.transaction.xa.GlobalTransaction, boolean)
invocation. As such, ThreadLocal
s should not be relied upon to maintain transaction context.
tx
- tx to commit
CacheLoaderException
- in the event of problems writing to the storevoid rollback(GlobalTransaction tx)
prepare(java.util.List, org.infinispan.transaction.xa.GlobalTransaction, boolean)
. The implementation would
need to deal with this case accordingly. Typically, this would be a no-op, after ensuring any resources attached
to the transaction are cleared up.
Also note that this method may be invoked on a thread which is different from the prepare(java.util.List, org.infinispan.transaction.xa.GlobalTransaction, boolean)
invocation. As such, ThreadLocal
s should not be relied upon to maintain transaction context.
tx
- tx to roll backCacheStoreConfig getCacheStoreConfig()
|
--> | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |