|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IMap
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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Method Summary | |
---|---|
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. |
Attribute |
getAttribute(Object key,
String attributeName)
Deprecated. This method will not be available in future versions |
Attribute[] |
getAttributes(Object key)
Deprecated. This method will not be available in future versions |
Attribute[] |
getAttributes(Object key,
long waitForResponse)
Deprecated. This method will not be available in future versions |
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()
Returns active transaction or null if no transaction defined. |
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,
Attribute[] attributes)
Deprecated. This method will not be available in future versions. |
Object |
put(Object key,
Object value,
Attribute[] attributes,
long timeToLive)
Deprecated. This method will not be available in future versions. |
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 |
remove(Object key,
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)
Set current transaction, all the map calls will be performed under this transaction. |
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. |
Methods inherited from interface com.j_spaces.javax.cache.Cache |
---|
addListener, clear, containsKey, containsValue, entrySet, equals, evict, get, getAll, getCacheEntry, hashCode, isEmpty, keySet, load, loadAll, peek, put, putAll, remove, removeListener, size, values |
Method Detail |
---|
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 milliseconds
@Deprecated Object put(Object key, Object value, Attribute[] attributes)
value
to the cache with specified key
and
attributes
.
key
- key for the value
value
- object(~ entry)attributes
- attributes to associate the value
with
@Deprecated Object put(Object key, Object value, Attribute[] attributes, long timeToLive)
value
to the cache with specified key
and
attributes
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 millisecondsattributes
- attributes to associate the key
with
Object 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 response
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 response
void clear(boolean clearMaster)
clearMaster
- if true
clear also master, when false
equals to clear()@Deprecated Attribute[] getAttributes(Object key)
key
.
key
- the key to an object in this cache
key
@Deprecated Attribute[] getAttributes(Object key, long waitForResponse)
key
Client will wait at most waitForResponse
milliseconds for
get call to return.
key
- the key to an object in this cachewaitForResponse
- time to wait for response
key
@Deprecated Attribute getAttribute(Object key, String attributeName)
key
and
its name equals to attributeName
.
key
- the key to an object in this cacheattributeName
- name of the attribute associated with the key
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
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 locking
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |