public interface IMap extends Cache
Use GigaMap
instead.
This interface extends Map
interface and provides Map interface to GigaSpaces.
The IMap interface can be used in remote , embedded and Master-Local Topology.
The Map interface provides three collection views, which allow a map's contents to be viewed
as a set of keys, collection of values, or set of key-value mappings.
You can associate attributes to a key and values (e.g. security tags, special user profiles, etc.), and set time for entries to exist in the cache until eviction.
GigaMap
Modifier and Type | Method and Description |
---|---|
void |
clear(boolean clearMaster)
The clear method will remove all objects from
the cache including the key and the associated value.
|
Object |
get(Object key,
long waitForResponse)
Returns the object that is associated with
key in this cache. |
Object |
get(Object key,
Transaction txn,
long waitForResponse,
int readModifiers)
Returns the object that is associated with
key in this cache. |
IJSpace |
getLocalSpace()
Returns the Local Space proxy if exists.
|
IJSpace |
getMasterSpace()
Returns the Master Space proxy.
|
long |
getTimeToLive()
Returns how long cached objects will live in the cache.
|
Transaction |
getTransaction()
Deprecated.
use explicit transaction instead
|
long |
getWaitForResponse()
Returns how long wait for response for the
put(java.lang.Object, java.lang.Object, long) , get(java.lang.Object, long) and remove(java.lang.Object, long) calls. |
boolean |
isVersioned()
Check if using optimistic locking.
|
Object |
put(Object key,
Object value,
long timeToLive)
Puts
value to the cache with specified key for
timeToLive milliseconds to live in the cache. |
Object |
put(Object key,
Object value,
long timeToLive,
long timeout)
Puts
value to the cache with specified key for
timeToLive milliseconds to live in the cache. |
Object |
put(Object key,
Object value,
Transaction txn,
long timeToLive)
Puts
value to the cache with specified key for
timeToLive milliseconds to live in the cache. |
Object |
put(Object key,
Object value,
Transaction txn,
long timeToLive,
long waitForResponse)
Puts
value to the cache with specified key for
timeToLive milliseconds to live in the cache. |
void |
putAll(Map map,
Transaction txn,
long timeToLive)
Copies all of the mappings from the specified map to the cache.
|
Object |
remove(Object key,
long waitForResponse)
Removes the mapping for this
key from this cache. |
Object |
remove(Object key,
Transaction txn,
long waitForResponse)
Removes the mapping for this
key from this cache. |
void |
setTimeToLive(long millisecond)
Sets the duration that entries will stay in the cache.
|
void |
setTransaction(Transaction transaction)
Deprecated.
use explicit transaction instead
|
void |
setVersioned(boolean versioned)
Sets optimistic locking mode.
|
void |
setWaitForResponse(long timeout)
Sets the timeout for the
put(java.lang.Object, java.lang.Object, long) , get(java.lang.Object, long) and remove(java.lang.Object, long) calls to wait for response. |
addListener, clear, containsKey, containsValue, entrySet, equals, evict, get, getAll, getCacheEntry, hashCode, isEmpty, keySet, load, loadAll, peek, put, putAll, remove, removeListener, size, values
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
void setTimeToLive(long millisecond)
millisecond
- how long entries will live in the cache, in millisecondslong getTimeToLive()
void setWaitForResponse(long timeout)
put(java.lang.Object, java.lang.Object, long)
, get(java.lang.Object, long)
and remove(java.lang.Object, long)
calls to wait for response.timeout
- time to wait for responselong getWaitForResponse()
put(java.lang.Object, java.lang.Object, long)
, get(java.lang.Object, long)
and remove(java.lang.Object, long)
calls.Object put(Object key, Object value, long timeToLive)
value
to the cache with specified key
for
timeToLive
milliseconds to live in the cache.key
- key for the value
value
- object(~ entry)timeToLive
- time to keep object in this cache, in millisecondsObject put(Object key, Object value, long timeToLive, long timeout)
value
to the cache with specified key
for
timeToLive
milliseconds to live in the cache.key
- key for the value
value
- object(~ entry)timeToLive
- time to keep object in this cache, in millisecondsObject put(Object key, Object value, Transaction txn, long timeToLive)
value
to the cache with specified key
for
timeToLive
milliseconds to live in the cache.key
- key for the value
value
- object(~ entry)txn
- the transaction object, if any, under which to
perform the puttimeToLive
- time to keep object in this cache, in millisecondsObject put(Object key, Object value, Transaction txn, long timeToLive, long waitForResponse)
value
to the cache with specified key
for
timeToLive
milliseconds to live in the cache.key
- key for the value
value
- object(~ entry)txn
- the transaction object, if any, under which to
perform the puttimeToLive
- time to keep object in this cache, in millisecondswaitForResponse
- time to wait for responsevoid putAll(Map map, Transaction txn, long timeToLive)
map
- A map of key and values to be copy into the cachetxn
- the transaction object, if any, under which to
perform the puttimeToLive
- time to keep object in this cache, in millisecondsObject get(Object key, long waitForResponse)
key
in this cache.
Client will wait at most waitForResponse
milliseconds for
get call to return.key
- key whose associated value is to be returned.waitForResponse
- time to wait for responseObject get(Object key, Transaction txn, long waitForResponse, int readModifiers)
key
in this cache.
Client will wait at most waitForResponse
milliseconds for
get call to return.key
- key whose associated value is to be returned.txn
- the transaction object, if any, under which to
perform the getwaitForResponse
- time to wait for responsereadModifiers
- one or a union of ReadModifiers
.Object remove(Object key, long waitForResponse)
key
from this cache.
Client will wait at most waitForResponse
milliseconds for
get call to return.key
- key whose associated value is to be returned.waitForResponse
- time to wait for responseObject remove(Object key, Transaction txn, long waitForResponse)
key
from this cache.
Client will wait at most waitForResponse
milliseconds for
get call to return.key
- key whose associated value is to be returned.txn
- the transaction object, if any, under which to
perform the removewaitForResponse
- time to wait for responsevoid clear(boolean clearMaster)
clearMaster
- if true
clear also master, when false
equals to clear()@Deprecated void setTransaction(Transaction transaction)
null
will turn all the following map calls to
be with transaction.
In order to
IMap map = ... ;
TransactionManager tm = ... ;
Transaction.Created created = TransactionFactory#create(tm, 10000);
map.setTransaction(Created.transaction)
map.put( "key1", "value1"); // under transaction
map.put( "key2", "value2"); // under transaction
Created.transaction.commit();
map.setTransaction( null);
map.remove( "key2"); // not under transaction
transaction
- active transaction or null
@Deprecated Transaction getTransaction()
null
if no transaction defined.IJSpace getMasterSpace()
IJSpace getLocalSpace()
void setVersioned(boolean versioned)
versioned
- true
if optimistic locking is neededboolean isVersioned()
true
if using optimistic lockingCopyright © GigaSpaces.