public final class GSMapImpl extends AbstractMap
Map
API. Simply call Map.get and Map.put methods to store and retrieve values
into or from the cache._compression, _entryInfos, _isVersioned, _spaceProxy, _timeout, _timeToLive, _transaction, NONE_COMPRESSION, ZIP_COMPRESSION
Modifier | Constructor and Description |
---|---|
|
GSMapImpl(IJSpace space)
GSMap constructor.
|
|
GSMapImpl(IJSpace space,
int compress)
GSMap constructor.
|
|
GSMapImpl(IJSpace space,
long timeToLive)
GSMap constructor.
|
protected |
GSMapImpl(IJSpace space,
long timeToLive,
Transaction txn,
int compress)
GSMapImpl constructor.
|
|
GSMapImpl(IJSpace space,
Transaction txn)
GSMap constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(CacheListener listener)
Unsupported Operation! Add a listener to the list of cache listeners.
Optional, not supported by all the implementations, currently supported only by local cache. |
void |
clear()
The clear method will remove all objects from the cache including the key and the associated
value.
|
void |
clear(boolean clearMaster)
The clear method will remove all objects from the cache including the key and the associated
value.
|
boolean |
containsKey(Object key)
Returns true if the cache contains the specified key.
|
boolean |
containsValue(Object value)
Returns true if this cache maps one or more keys to the specified value.
|
Set |
entrySet()
Returns a set view of the objects currently contained in the cache.
|
boolean |
evict(Object key)
The evict method will remove object from the cache the matches the provided key.
|
CacheEntry |
getCacheEntry(Object key)
Returns the CacheEntry object associated with the object identified by "key".
|
protected Object |
internalGet(Object key,
Transaction txn,
long waitForResponse,
int readModifiers)
Gets the mapping for this key from this map if it is present.
|
protected Object |
internalGet(Object key,
Transaction txn,
long waitForResponse,
int readModifiers,
boolean isRemove)
Gets or Removes the mapping for this key from this map if present (optional operation).
|
protected Object |
internalPut(Object key,
Object value,
Transaction txn,
long timeToLive,
long timeout)
Puts
value to the cache with specified key and
attributes for timeToLive milliseconds to live in the cache. |
protected Object |
internalRemove(Object key,
Transaction txn,
long waitForResponse)
Removes the mapping for this key from this map if it is present.
|
Set |
keySet()
Returns a set view of the keys currently contained in the cache.
|
Object |
peek(Object key)
The peek method will return the object associated with "key" if it currently exists (and is
valid) in the cache.
|
void |
removeListener(CacheListener listener)
Unsupported Operation! Remove a listener from the list of cache listeners.
Optional, not supported by all the implementations, currently supported only by local cache |
Collection |
values()
Returns a collection view of the values contained in this cache.
|
buildEnvelope, get, get, get, getAll, getLocalSpace, getMasterSpace, getTimeToLive, getTransaction, getWaitForResponse, isEmpty, isVersioned, load, loadAll, log, log, put, put, put, put, put, putAll, putAll, remove, remove, remove, setTimeToLive, setTransaction, setVersioned, setWaitForResponse, size
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
protected GSMapImpl(IJSpace space, long timeToLive, Transaction txn, int compress)
space
- Space proxy or DCache proxy.timeToLive
- Time to live for value
object in cache, use -1 for default
value.txn
- if not null
all operation will be executed with the desired
transaction.compress
- the compress level can be 1-9
To set new transaction use: setTransaction(txn) To reset the transaction
use: setTransaction(null) To get the current transaction use:
getTransaction()public GSMapImpl(IJSpace space)
space
- Space proxy or DCache proxy.public GSMapImpl(IJSpace space, long timeToLive)
space
- Space proxy or DCache proxy.timeToLive
- Time to live for value
object in cache.public GSMapImpl(IJSpace space, int compress)
space
- Space proxy or DCache proxy.compress
- Compress value
object in cache.public GSMapImpl(IJSpace space, Transaction txn)
space
- Space proxy or DCache proxy.txn
- if not null
all operation will be executed with the desired
transaction. To set new transaction use: setTransaction(txn) To reset the
transaction use: setTransaction(null) To get the current transaction use:
getTransaction()protected Object internalPut(Object key, Object value, Transaction txn, long timeToLive, long timeout) throws CacheException
value
to the cache with specified key
and
attributes
for timeToLive
milliseconds to live in the cache. If
there is no value
with specified key
in the cache then
value
will be written to the cache first time otherwise value
will
be updated.internalPut
in class AbstractMap
key
- key for the value
value
- object(~ entry)timeToLive
- time to keep object in this cache, in millisecondstimeout
- attributes to associate the key
withtxn
- transactionCacheException
- if error accord during putprotected Object internalRemove(Object key, Transaction txn, long waitForResponse) throws CacheException
internalRemove
in class AbstractMap
key
- key whose mapping is to be removed from the map.waitForResponse
- to wait for responseCacheException
public boolean containsKey(Object key)
key
- key whose presence in this cache is to be tested.true
, if the cache contains the specified key.public boolean containsValue(Object value)
value
- value whose presence in this cache is to be tested.true
, if the cache contains the specified value.protected Object internalGet(Object key, Transaction txn, long waitForResponse, int readModifiers)
internalGet
in class AbstractMap
key
- key whose mapping is to be removed from the map.waitForResponse
- to wait for responseprotected Object internalGet(Object key, Transaction txn, long waitForResponse, int readModifiers, boolean isRemove)
waitForResponse
milliseconds for get call to return.isRemove
- true
if remove operation, otherwise false;public void clear()
public void clear(boolean clearMaster)
clearMaster
- if true
clear also master, when false
equals to
clear()public Collection values()
public Set entrySet()
public Set keySet()
public final void addListener(CacheListener listener)
listener
- call back CacheListener
public final boolean evict(Object key)
key
- the key to evicttrue
, if the key was evictedpublic final CacheEntry getCacheEntry(Object key)
key
- key whose associated value is to be returned.public Object peek(Object key)
key
- key whose associated value is to be peek.public void removeListener(CacheListener listener)
listener
- the CacheListener
to removeCopyright © GigaSpaces.