You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-users@jakarta.apache.org by Niall Gallagher <ni...@switchfire.com> on 2006/02/23 18:15:21 UTC

JCS as both local and remote cache?

Hi,

Can anybody answer the following for me?

I have a JBoss server which I want to use as a central point of access
to a database. Client machines will only be able to write to the
database by calling EJB method on the JBoss machine. Client machines
will not hold direct connections to the database themselves.

I want the JBoss server to use JCS as a caching layer to sit between all
clients and the database. JCS will run inside JBoss. Also, I want client
machines to run JCS locally as a local cache, configured to use the
JBoss central machine as a remote cache.

Client machines will not write to the central cache directly. If they
call EJBs on the central JBoss machine to update the database, the
central EJBs will update the central cache with the new data at the same
time. If clients then try to access data from their local cache, since
it is not cached locally, the client-side JCS cache will download it
from the central (remote) cache automatically. If clients find that
required data is not available locally or centrally, they will call
methods on the JBoss machine to have it loaded into the cache.

If the JBoss server updates or removes data in the central cache, JCS
will automatically issue 'remove' commands to all client caches.

So I think this approach will ensure all caches remain in sync almost
all of the time (ignoring the intricacies of asynchronous queueing!).

My question is: How do I configure the central cache?

If a line of code on the central server reads jcs.put("myKey",
"myValue"); will the central JCS cache automatically issue remove
commands to clients for "myKey"?

The central server needs to be configured as a local cache for its own
use, but it should also know that it is a remote cache to clients, and
therefore needs to issue these remove commands.

Any suggestions?


By the way, I think JCS is an extremely well written piece of software.
Hopefully the recent additions to the JCS website will help it get some
more recognition for this, which I think it deserves.