public interface CachePeer extends Remote
It is acknowledged that not all implementations will use Remote. Remote is just a marker interface like Serializable, so nothing specific is required.
Non-RMI implementations should be able to use this interface. Implementations not using RMI should
| Modifier and Type | Method and Description |
|---|---|
List |
getElements(List keys)
Gets a list of elements from the cache, for a list of keys, without updating Element statistics.
|
String |
getGuid()
Gets the globally unique id for the underlying
Cache instance. |
List |
getKeys()
Returns a list of all elements in the cache, whether or not they are expired.
|
String |
getName()
Gets the cache name.
|
Element |
getQuiet(Serializable key)
Gets an element from the cache, without updating Element statistics.
|
String |
getUrl()
The URL for the remote replicator to connect.
|
String |
getUrlBase()
The URL base for the remote replicator to connect.
|
void |
put(Element element)
Put an element in the cache.
|
boolean |
remove(Serializable key)
Removes an
Element from the Cache. |
void |
removeAll()
Removes all cached items.
|
void |
send(List eventMessages)
Send the cache peer with an ordered list of
EventMessages. |
void put(Element element) throws IllegalArgumentException, IllegalStateException, RemoteException
Resets the access statistics on the element, which would be the case if it has previously been gotten from a cache, and is now being put back.
element - IllegalStateException - if the cache is not Status.STATUS_ALIVEIllegalArgumentException - if the element is nullRemoteExceptionboolean remove(Serializable key) throws IllegalStateException, RemoteException
Element from the Cache. This also removes it from any
stores it may be in.key - IllegalStateException - if the cache is not Status.STATUS_ALIVERemoteExceptionvoid removeAll()
throws RemoteException,
IllegalStateException
IllegalStateException - if the cache is not Status.STATUS_ALIVERemoteExceptionvoid send(List eventMessages) throws RemoteException
EventMessages.
This enables multiple messages to be delivered in one network invocation.
eventMessages - a list of type EventMessageRemoteExceptionString getName() throws RemoteException
RemoteExceptionString getGuid() throws RemoteException
Cache instance.RemoteExceptionString getUrl() throws RemoteException
This method is not meant to be used remotely. The replicator already needs to know this. It has to throw RemoteException to comply with RMI requirements
RemoteExceptionString getUrlBase() throws RemoteException
RemoteExceptionList getKeys() throws RemoteException
The returned keys are unique and can be considered a set.
The List returned is not live. It is a copy.
The time taken is O(n). On a single cpu 1.8Ghz P4, approximately 8ms is required for each 1000 entries.
Object keysRemoteExceptionElement getQuiet(Serializable key) throws RemoteException
key - a serializable valueRemoteExceptionList getElements(List keys) throws RemoteException
Cache statistics are still updated.
keys - a list of serializable values which represent keysRemoteExceptionCopyright 2001-2021, Terracotta, Inc.