Dec 22nd, 2005, 04:29 AM
declarative caching with context specific objects
(already mailed this to firstname.lastname@example.org, but no responses there)
I'm currently working with a vendor's closed source API.
The vendor's software consists of a client library (including
ServiceLocator) and a set of EJB's deployed on some server. The client
library is the API I'm talking about.
Now, everything on the ServiceLocator is authentication protected.
Whenever I want to get some service, I have to call a login(user,pwd)
method first. So everything that comes from a service is context
specific (per-user). Even simple factories to create objects are
context-specific. It still puzzles me why they ever implemented their
API like that in the first place, but I'm stuck with it.
Now the caching part. I want to cache the ServiceLocator reference
(since logging in is expensive) and objects retrieved by some
services. And since all objects are ServiceLocator-scoped, when the
ServiceLocator gets flushed, all the objects that go with it should
get flushed too.
My guess is that I'll have to create a per-ServiceLocator cache
instance/group. This seems possible programatically, but I want to do
this as declarative as possible.
Any input on this?