|
GigaSpaces XAP 7.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface GigaMap
Provides a simpler interface on top of IMap
and
Cache
implementation.
Though this interface has a single implementation it is still important to work against the interface as it allows for simpler testing and mocking.
Transaction management is implicit and works in a declarative manner. Operations do not accept a
transaction object, and will automatically use the TransactionProvider
in order to acquire
the current running transaction. If there is no current running transaction the operation will be
executed without a transaction.
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. |
Object |
get(Object key,
long waitForResponse,
int modifiers)
Returns the object that is associated with key in this cache. |
net.jini.core.transaction.Transaction |
getCurrentTransaction()
Returns the current running transaction. |
long |
getDefaultTimeToLive()
Returns the default time to live of entries in the map. |
long |
getDefaultWaitForResponse()
Returns the default wait for response value for entries in the map. |
IMap |
getMap()
Returns the IMap used by this GigaMap implementation to delegate
different space operations. |
TransactionProvider |
getTxProvider()
Returns the transaction provider allowing accessing the current running transaction. |
boolean |
isLocked(Object key)
Returns true if the given key is locked. |
LockHandle |
lock(Object key)
Locks the given key for any updates. |
LockHandle |
lock(Object key,
long lockTimeToLive,
long waitingForLockTimeout)
Locks the given key for any updates. |
Object |
put(Object key,
Object value,
LockHandle lockHandle)
Puts value to the cache with specified key . |
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,
LockHandle lockHandle)
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. |
void |
putAll(Map t,
long timeToLive)
Copies all of the mappings from the specified map to the cache. |
void |
putAndUnlock(Object key,
Object value)
Unlocks the given key and puts the given value in a single operation. |
Object |
remove(Object key,
long waitForResponse)
Removes the mapping for this key from this cache. |
Object |
remove(Object key,
long waitForResponse,
LockHandle lockHandle)
Removes the mapping for this key from this cache. |
void |
unlock(Object key)
Unlocks the given lock on the key |
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 |
---|
IMap getMap()
IMap
used by this GigaMap implementation to delegate
different space operations.
Allows to execute map operations that are not exposed by this interface, as well as using it as a parameter to other low level GigaSpace components.
If a transaction object is required for low level operations (as low level operations do not
have declarative transaction ex) the getTxProvider()
should be used to acquire the
current running transaction.
TransactionProvider getTxProvider()
IMap
operations that requires explicit
transaction object.
net.jini.core.transaction.Transaction getCurrentTransaction()
null
if no transaction is in progress.
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 get(Object key, long waitForResponse, int modifiers)
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 responsemodifiers
- one or a union of ReadModifiers
.
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
Object 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 millisecondstimeout
- A timeout to use if the object is locked under a transaction (in milliseconds)
Object put(Object key, Object value, LockHandle lockHandle)
value
to the cache with specified key
.
key
- key for the value
value
- object(~ entry)lockHandle
- If the key is locked, will perform the operation within the same lock
Object put(Object key, Object value, long timeToLive, LockHandle lockHandle)
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 millisecondslockHandle
- If the key is locked, will perform the operation within the same lock
void putAll(Map t, long timeToLive)
t
- A map of key and values to be copy into the cacheObject 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
Object remove(Object key, long waitForResponse, LockHandle lockHandle)
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 responselockHandle
- If the key is locked, will perform the operation within the same lock
void clear(boolean clearMaster)
clearMaster
- if true
clear also master, when false
same as Map.clear()
.)LockHandle lock(Object key)
LockHandle
that can be bused to perform specific updates under the same lock (by calling
put(Object,Object,org.openspaces.core.map.LockHandle)
for example).
Will use the configured default lock time to live and default waiting for lock timeout values. By default the lock time to live is 60 seconds and waiting for lock timeout is 10 seconds.
key
- The key to lock
LockHandle lock(Object key, long lockTimeToLive, long waitingForLockTimeout)
LockHandle
that can be used to perform specific updates under the same lock (by using the transaction
object stored within it).
key
- The key to locklockTimeToLive
- The lock time to live (in milliseconds)waitingForLockTimeout
- The time to wait for an already locked lock
void unlock(Object key)
key
- The key to unlockboolean isLocked(Object key)
true
if the given key is locked. Otherwise returns false
.
key
- The key to check if it locked or not.
true
if the given key is locked or not.void putAndUnlock(Object key, Object value)
key
- The key to unlock and put the value invalue
- The value to put after unlocking the keylong getDefaultTimeToLive()
long getDefaultWaitForResponse()
|
GigaSpaces XAP 7.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |