Class StreamingRemoteCacheImpl<K>
- java.lang.Object
-
- org.infinispan.client.hotrod.impl.StreamingRemoteCacheImpl<K>
-
- All Implemented Interfaces:
StreamingRemoteCache<K>
public class StreamingRemoteCacheImpl<K> extends Object implements StreamingRemoteCache<K>
Implementation ofStreamingRemoteCache
- Since:
- 9.0
- Author:
- Tristan Tarrant
-
-
Constructor Summary
Constructors Constructor Description StreamingRemoteCacheImpl(RemoteCacheImpl<K,?> cache)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends InputStream & VersionedMetadata>
Tget(K key)
Retrieves the value of the specified key as anInputStream
.OutputStream
put(K key)
Initiates a streaming put operation.OutputStream
put(K key, long lifespan, TimeUnit unit)
An overloaded form ofStreamingRemoteCache.put(Object)
, which takes in lifespan parameters.OutputStream
put(K key, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
An overloaded form ofStreamingRemoteCache.put(Object)
, which takes in lifespan and maxIdle parameters.OutputStream
putIfAbsent(K key)
A conditional form of put which inserts an entry into the cache only if no mapping for the key is already present.OutputStream
putIfAbsent(K key, long lifespan, TimeUnit unit)
An overloaded form ofStreamingRemoteCache.putIfAbsent(Object)
which takes in lifespan parameters.OutputStream
putIfAbsent(K key, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
An overloaded form ofStreamingRemoteCache.putIfAbsent(Object)
which takes in lifespan and maxIdle parameters.OutputStream
replaceWithVersion(K key, long version)
A form ofStreamingRemoteCache.put(Object)
, which takes in a version.OutputStream
replaceWithVersion(K key, long version, long lifespan, TimeUnit unit)
An overloaded form ofStreamingRemoteCache.replaceWithVersion(Object, long)
which takes in lifespan parameters.OutputStream
replaceWithVersion(K key, long version, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
An overloaded form ofStreamingRemoteCache.replaceWithVersion(Object, long)
which takes in lifespan and maxIdle parameters.
-
-
-
Constructor Detail
-
StreamingRemoteCacheImpl
public StreamingRemoteCacheImpl(RemoteCacheImpl<K,?> cache)
-
-
Method Detail
-
get
public <T extends InputStream & VersionedMetadata> T get(K key)
Description copied from interface:StreamingRemoteCache
Retrieves the value of the specified key as anInputStream
. It is up to the application to ensure that the stream is consumed and closed. The marshaller is ignored, i.e. all data will be read in its raw binary form. The returned input stream implements theVersionedMetadata
interface. The returned input stream is not thread-safe.- Specified by:
get
in interfaceStreamingRemoteCache<K>
- Parameters:
key
- key to use
-
put
public OutputStream put(K key)
Description copied from interface:StreamingRemoteCache
Initiates a streaming put operation. It is up to the application to write to the returnedOutputStream
and close it when there is no more data to write. The marshaller is ignored, i.e. all data will be written in its raw binary form. The returned output stream is not thread-safe.- Specified by:
put
in interfaceStreamingRemoteCache<K>
- Parameters:
key
- key to use
-
put
public OutputStream put(K key, long lifespan, TimeUnit unit)
Description copied from interface:StreamingRemoteCache
An overloaded form ofStreamingRemoteCache.put(Object)
, which takes in lifespan parameters. The returned output stream is not thread-safe.- Specified by:
put
in interfaceStreamingRemoteCache<K>
- Parameters:
key
- key to uselifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit
- unit of measurement for the lifespan
-
put
public OutputStream put(K key, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
Description copied from interface:StreamingRemoteCache
An overloaded form ofStreamingRemoteCache.put(Object)
, which takes in lifespan and maxIdle parameters. The returned output stream is not thread-safe.- Specified by:
put
in interfaceStreamingRemoteCache<K>
- Parameters:
key
- key to uselifespan
- lifespan of the entrylifespanUnit
-TimeUnit
for lifespanmaxIdle
- the maximum amount of time this key is allowed to be idle for before it is considered as expiredmaxIdleUnit
-TimeUnit
for maxIdle
-
putIfAbsent
public OutputStream putIfAbsent(K key)
Description copied from interface:StreamingRemoteCache
A conditional form of put which inserts an entry into the cache only if no mapping for the key is already present. The operation is atomic. The server only performs the operation once the stream has been closed. The returned output stream is not thread-safe.- Specified by:
putIfAbsent
in interfaceStreamingRemoteCache<K>
- Parameters:
key
- key to use
-
putIfAbsent
public OutputStream putIfAbsent(K key, long lifespan, TimeUnit unit)
Description copied from interface:StreamingRemoteCache
An overloaded form ofStreamingRemoteCache.putIfAbsent(Object)
which takes in lifespan parameters. The returned output stream is not thread-safe.- Specified by:
putIfAbsent
in interfaceStreamingRemoteCache<K>
- Parameters:
key
- key to uselifespan
- lifespan of the entryunit
-TimeUnit
for lifespan
-
putIfAbsent
public OutputStream putIfAbsent(K key, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
Description copied from interface:StreamingRemoteCache
An overloaded form ofStreamingRemoteCache.putIfAbsent(Object)
which takes in lifespan and maxIdle parameters. The returned output stream is not thread-safe.- Specified by:
putIfAbsent
in interfaceStreamingRemoteCache<K>
- Parameters:
key
- key to uselifespan
- lifespan of the entrylifespanUnit
-TimeUnit
for lifespanmaxIdle
- the maximum amount of time this key is allowed to be idle for before it is considered as expiredmaxIdleUnit
-TimeUnit
for maxIdle
-
replaceWithVersion
public OutputStream replaceWithVersion(K key, long version)
Description copied from interface:StreamingRemoteCache
A form ofStreamingRemoteCache.put(Object)
, which takes in a version. The value will be replaced on the server only if the existing entry's version matches. The returned output stream is not thread-safe.- Specified by:
replaceWithVersion
in interfaceStreamingRemoteCache<K>
- Parameters:
key
- key to useversion
- the version to check for
-
replaceWithVersion
public OutputStream replaceWithVersion(K key, long version, long lifespan, TimeUnit unit)
Description copied from interface:StreamingRemoteCache
An overloaded form ofStreamingRemoteCache.replaceWithVersion(Object, long)
which takes in lifespan parameters. The returned output stream is not thread-safe.- Specified by:
replaceWithVersion
in interfaceStreamingRemoteCache<K>
- Parameters:
key
- key to useversion
- the version to check forlifespan
- lifespan of the entryunit
-TimeUnit
for lifespan
-
replaceWithVersion
public OutputStream replaceWithVersion(K key, long version, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
Description copied from interface:StreamingRemoteCache
An overloaded form ofStreamingRemoteCache.replaceWithVersion(Object, long)
which takes in lifespan and maxIdle parameters. The returned output stream is not thread-safe.- Specified by:
replaceWithVersion
in interfaceStreamingRemoteCache<K>
- Parameters:
key
- key to useversion
- the version to check forlifespan
- lifespan of the entrylifespanUnit
-TimeUnit
for lifespanmaxIdle
- the maximum amount of time this key is allowed to be idle for before it is considered as expiredmaxIdleUnit
-TimeUnit
for maxIdle
-
-