Distributed Cache Local Peer
Each distributed cache peer holds its own local copy of cached data.
On the simplest scenenario there is only one client cache peer witch stores data localy for faster access and reduce network bandwitch consumption.
As data is kept localy at each peer, when more than one client peer concurrently access the same data, a cache coordinator becomes necessary.
The cache coordinator is an EJB that must be installed at an application server such as JBoss or BEA Weblogic. See cache.DistributedCacheCoordinatorBean for more information about the cache coordinator.
Distributed Cache Tokens and Policies
A cache peer is essentially a named set of objects. Each object name is called a "cache token". Cache Token associate a String (the object name) with the actual cached object.
Token have an usage count and a last usage date, each time a token is requested its usage count and last usage dates are updated at the cache peer.
The cache peer the applies a customizable Policy for discarding objects as cache becomes full.
Currently only a Least Recently Used Cache Policy is provided.
By default the cache has a maximum of 400 objects slots.
There is no checking of memory consumption for the cache peer, it is the programmer's responsability not to cache objects that are too large.
It is also the programmer's task to remove tokens from the cache peer when the cached data has been changed.
Comunnication between client cache peers and the cache coordinator
The cache coordinator is a single object instance that coordinates data cached by multiple cache peers, at a given time a cache peer may change data that is already cache at another peer. When doing so the last usage date for the token of cached data will be updated and the cache coordinator will be notified of this last usage change.
Each cache peer holds its own copy of data, and the cache coordinator keeps a record of all last usage timestamp for every object at every cache peer. In this way, cached data is not be shared among peers, but it is kept synchronized by discarding all tokens witch timestamp at the peer is older than the one at the cache coordinator.
UML
@author Sergio Montoro Ten @version 4.0
|
|
|
|
|
|