Hi Aaron, thanks a lot for your time. Perhaps I didn't make myself clear
what I'm trying to do.
At the moment, I have defined a region "webservice" in a configuration file:
jcs.region.webservice=DC
The component that will call the webservice (WebServiceInvoker) will use a
cache.
public class WebServiceInvoker {
private JCS cache;
public WebServiceInvoker(URL service) {
cache = JCS.getInstance("webservice");
}
...
}
If I do this, all my WebServiceInvokers will use the same cache (which I
don't want if they are calling different webservices).
I want something like this:
public class WebServiceInvoker {
private JCS cache;
public WebServiceInvoker(URL service) {
cache = JCS.getInstance("webservice." + convertToUniqueID(service));
}
...
}
In this way, WebServiceInvoker which are calling the same webservice will
use the same cache, but invokers that call different webservices will use
different caches. The problem is that the region I specify now
("webservice.aWebServiceID") doesn't exist in my configuration file (only
the region "webservice" exist). And because I don't know which services
will be called, I cannot define these specific regions in advance. But if
you think of it in LOG4J terminolgy (where you have a hierarchy of
categories, seperated by "."), you can say that the region I use now is a
child of the region "webservice" and should have same configuration as the
"webservice" region I have defined in the configuration file.
I hope that I've illustrated clearly what I'm trying to do?
I'm new to JCS and caching, so it's probably possible that this can be
solved very easily.
thanks
Maarten
At 16:56 6/06/2002 -0400, you wrote:
>You have someway to identify the service and the region that you should be
>using.
>
>I'm not exactly sure what you are trying to do.
>
>You can preconfigure regions in the cache.ccf file and then reference them
>by name. You just call the get instance with a different region name.
>
> > -----Original Message-----
> > From: Maarten Coene [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, June 06, 2002 4:05 PM
> > To: Turbine JCS Users List
> > Subject: Re: More than 1 cache-instance [not] needed
> >
> > How can I define these unique regions at runtime (since I don't know which
> > webservices will be called in advance because the user can add such
> > servers at execution time).
> >
> > And if I define these regions at runtime, can I also "inherit" the
> > settings of a predefined region? For example: can I define a region (e.g.
> > webServicesRegion in a config file) and let these runtime defined regions
> > have the same settings as this predefined region?
> >
> > Thanks,
> > Maarten
> >
> > On Thu, 6 Jun 2002, Aaron Smuts wrote:
> >
> > > It might be nice to be able to run multiple instances of the cache, but
> > that
> > > is completely unnecessary to solve this simple problem.
> > >
> > > You don't need multiple instances of the JCS caching system, you just
> > need
> > > to use different regions. The entire system is built around the idea of
> > > separate cache regions with configurable behaviors.
> > >
> > > Think of the JCS class as a cache access class. It is just a wrapper
> > around
> > > the GroupCacheAccess. The cache is a hub that manages auxiliaries and
> > > regions.
> > >
> > > You just need to use different regions. Get different JCS access
> > objects
> > > for each webservice.
> > >
> > > It may be confusing that the access class is called JCS.
> > >
> > > Aaron
> > >
> > >
> > > > -----Original Message-----
> > > > From: James Taylor [mailto:[EMAIL PROTECTED]]
> > > > Sent: Thursday, June 06, 2002 1:55 PM
> > > > To: Turbine JCS Users List
> > > > Subject: Re: More than 1 cache-instance needed
> > > >
> > > > You cannot currently. JCS is a singleton and thus within a classloader
> > > > you can only have one cache. You could construct your region names in
> > > > such a way that they are unique to a webservice.
> > > >
> > > > Best bet is to make JCS no longer exclusively singleton, and just
> > > > provide a singleton wrapper -- as has been done with velocity. This
> > > > would facilitate using it in a component oriented system (avalon!)
> > > >
> > > > Any help in this direction would certainly be appreciated =]
> > > >
> > > > On Thu, 2002-06-06 at 12:00, Maarten Coene wrote:
> > > > > Hi,
> > > > >
> > > > > I have a problem configuring my application.
> > > > >
> > > > > I have a component which can talk to a webservices (retrieve info,
> > > > etc...).
> > > > > I want to use a cache for this to avoid too many (slow) network-
> > traffic.
> > > > > There can be more than one such webservice, so I can create multiple
> > > > > component-instances (each instance can only talk to one webservice).
> > In
> > > > the
> > > > > constructor of my component, I create a cache like this:
> > > > >
> > > > > cache = JCS.getInstance("myWebserviceRegion");
> > > > >
> > > > > But this had as a side-effect that all my component-instances used
> > the
> > > > same
> > > > > cache (if I added something to the cache in one component, it also
> > > > existed
> > > > > in the cache of another component). I don't want this: I want a
> > seperate
> > > > > cach for each webservice (different instances talking to the same
> > > > > webservice may use the same cache, but different instances talking
> > to
> > > > > different webservices must use a different cache).
> > > > >
> > > > > How can I accomplish this behaviour?
> > > > >
> > > > > Thanks,
> > > > > Maarten
> > > > >
> > > > > --
> > > > > Maarten Coene
> > > > > Katholieke Universiteit Leuven
> > > > > Dept. Computerwetenschappen Tel: ++32 (0)16/32 78 25
> > > > > Celestijnenlaan 200A
> > > > > B-3001 Heverlee
> > > > >
> > > > >
> > > > > --
> > > > > To unsubscribe, e-mail: <mailto:turbine-jcs-user-> > >
> [EMAIL PROTECTED]>
> > > > > For additional commands, e-mail: <mailto:turbine-jcs-user-> > >
> [EMAIL PROTECTED]>
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail: <mailto:turbine-jcs-user-> > >
> [EMAIL PROTECTED]>
> > > > For additional commands, e-mail: <mailto:turbine-jcs-user-> > >
> [EMAIL PROTECTED]>
> > >
> >
> >
> > --
> > To unsubscribe, e-mail: <mailto:turbine-jcs-user->
> [EMAIL PROTECTED]>
> > For additional commands, e-mail: <mailto:turbine-jcs-user->
> [EMAIL PROTECTED]>
--
Maarten Coene
Katholieke Universiteit Leuven
Dept. Computerwetenschappen Tel: ++32 (0)16/32 78 25
Celestijnenlaan 200A
B-3001 Heverlee
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>