@Deprecated public interface Cache extends Map
A cache could be scoped, for examples to a JVM, all JVMs on a node, all nodes in a cluster, etc. Operations that are scoped to a cache such as put or load would affect all JVMs in the cache. So the object loaded in 1 JVM would be equally available to all other JVMs in the cache.
Objects are identified in the cache
by a key. A key can be any Java object that implements the uniquely the toString()
method. If the object is to be distributed or persisted (if supported) it must implement
serializable. Each object in the cache will have a CacheEntry
object associated with
it. This object will encapsulate the metadata associated with the cached object.
All the
methods that are inherited from Map might throw com.j_spaces.core.client.CacheException
. This Exception extends RuntimeException
in order to keep the Map
API.
CacheException
,
CacheEntry
Modifier and Type | Method and Description |
---|---|
void |
addListener(CacheListener listener)
Deprecated.
Add a listener to the list of cache listeners.
Optional, not supported by all the implementations, currently supported only by local cache. |
void |
clear()
Deprecated.
The clear method will remove all objects from the cache including the key and the associated
value.
|
boolean |
containsKey(Object key)
Deprecated.
Returns true if the cache contains the specified key.
|
boolean |
containsValue(Object value)
Deprecated.
Returns true if this cache maps one or more keys to the specified value.
|
Set |
entrySet()
Deprecated.
Returns a set view of the objects currently contained in the cache.
|
boolean |
equals(Object obj)
Deprecated.
Equality is based on the Set returned by entrySet.
|
boolean |
evict(Object key)
Deprecated.
The evict method will remove object from the cache the matches the provided key.
|
Object |
get(Object key)
Deprecated.
The get method will return, from the cache, the object associated with the argument "key".
|
Map |
getAll(Collection keys)
Deprecated.
The getAll method will return, from the cache, a Map of the objects associated with the
Collection of keys in argument "keys".
|
CacheEntry |
getCacheEntry(Object key)
Deprecated.
Returns the CacheEntry object associated with the object identified by "key".
|
int |
hashCode()
Deprecated.
Returns the hash code value for this cache.
|
boolean |
isEmpty()
Deprecated.
Return true if entrySet().isEmpty() return true.
|
Set |
keySet()
Deprecated.
Returns a set view of the keys currently contained in the cache.
|
void |
load(Object key)
Deprecated.
The load method provides a means to "pre load" the cache.
|
void |
loadAll(Collection keys)
Deprecated.
The loadAll method provides a means to "pre load" objects into the cache.
|
Object |
peek(Object key)
Deprecated.
The peek method will return the object associated with "key" if it currently exists (and is
valid) in the cache.
|
Object |
put(Object key,
Object value)
Deprecated.
The put method adds the object "value" to the cache identified by the object "key".
|
void |
putAll(Map map)
Deprecated.
Copies all of the mappings from the specified map to the cache.
|
Object |
remove(Object key)
Deprecated.
The remove method will delete the object from the cache including the key, the associated
value and the associated CacheStatistics object.
|
void |
removeListener(CacheListener listener)
Deprecated.
Remove a listener from the list of cache listeners.
Optional, not supported by all the implementations, currently supported only by local cache |
int |
size()
Deprecated.
Returns the size of this map.
|
Collection |
values()
Deprecated.
Returns a collection view of the values contained in this cache.
|
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
void addListener(CacheListener listener)
listener
- call back CacheListener
UnsupportedOperationException
- can be thrown by implementations that doesn't support
this methodvoid clear()
boolean containsKey(Object key)
containsKey
in interface Map
key
- key whose presence in this cache is to be tested.true
, if the cache contains the specified key.boolean containsValue(Object value)
containsValue
in interface Map
value
- value whose presence in this cache is to be tested.true
, if the cache contains the specified value.Set entrySet()
boolean equals(Object obj)
boolean evict(Object key)
key
- the key to evicttrue
, if the key was evictedObject get(Object key)
Map getAll(Collection keys) throws CacheException
keys
- keys whose associated values are to be returned.CacheException
- error accord while loadingCacheEntry getCacheEntry(Object key)
key
- key whose associated value is to be returned.int hashCode()
boolean isEmpty()
Set keySet()
void load(Object key) throws CacheException
key
- key whose associated value is to be loaded.CacheException
- error accord while loadingvoid loadAll(Collection keys) throws CacheException
keys
- keys' Collection whose associated value to be loaded using the associated
CacheLoader if this cache doesn't contain it.CacheException
- error accord while loadingObject peek(Object key)
key
- key whose associated value is to be peek.Object put(Object key, Object value)
void putAll(Map map)
Object remove(Object key)
void removeListener(CacheListener listener)
listener
- the CacheListener
to removeUnsupportedOperationException
- can be thrown by implementations that doesn't support
this methodint size()
Collection values()
Copyright © GigaSpaces.