|
From: David M. <dm...@mo...> - 2004-09-16 19:49:55
|
Here is a question I have not been able to get answered...
I'm trying to use OSCache's API to cache to disk. I've tried the
following
Properties props =3D new Properties();
props.put("cache.memory","false");
props.put("cache.persistence.class","com.opensymphony.oscache.plugins.di
skpersistence.DiskPersistenceListener");
props.put("cache.path","c:\\inleasingApp\\cache");
props.put("cache.capacity","10000");
props.put("cache.unlimited.disk","true");
admin =3D new GeneralCacheAdministrator(props);
In this case, I got a 1.cache file in the correct location.
I then did this
try
{
if (!StringUtils.isEmpty(reportData.getWhichValue()))
{
// Get from the cache
results =3D (InleasingReportsData)
admin.getFromCache(reportData.getWhichValue());
}
else
{
results =3D new InleasingReportsData();
results.setFirstName("No First Name");
results.setLastName("No Last Name");
results.setWhichValue("No value");
}
}
catch (NeedsRefreshException nre)
{
try
{
// Store in the cache
admin.putInCache(reportData.getWhichValue(), reportData);
results =3D new InleasingReportsData();
results.setFirstName("No First Name");
results.setLastName("No Last Name");
results.setWhichValue("No value");
}
catch (Exception ex)
{
// We have the current content if we want fail-over.
results =3D (InleasingReportsData) nre.getCacheContent();
// It is essential that cancelUpdate is called if the
// cached content is not rebuilt
admin.cancelUpdate(reportData.getWhichValue());
}
}
pulled pretty much from the website.
I get the following output
[DEBUG] 10 Aug 2004 15:23:00,298 AbstractConcurrentReadCache:get(671)
- get called (key=3D1)
[DEBUG] 10 Aug 2004 15:23:00,298
AbstractConcurrentReadCache:persistRetrieve(1014) - persistRetrieve
called (key=3D1)
[DEBUG] 10 Aug 2004 15:23:00,298 Cache:getCacheEntry(599) - No cache
entry exists for key=3D'1', creating
[DEBUG] 10 Aug 2004 15:23:00,330 AbstractConcurrentReadCache:get(671)
- get called (key=3D1)
[DEBUG] 10 Aug 2004 15:23:00,330
AbstractConcurrentReadCache:persistRetrieve(1014) - persistRetrieve
called (key=3D1)
[DEBUG] 10 Aug 2004 15:23:00,330 Cache:getCacheEntry(599) - No cache
entry exists for key=3D'1', creating
[DEBUG] 10 Aug 2004 15:23:00,330
AbstractConcurrentReadCache:persistStore(1061) - persistStore called
(key=3D1)
But when I try to retrieve using get from cache, it is never there.
I've replaced the GeneralCacheAdministrator and its properties with just
a call to new Cache(false,true) to not use memory,but use unlimited
disk.
Same results.
Any ideas what I'm doing wrong?
Thanks,
David H. McCoy
-----Original Message-----
From: March, Andres [mailto:am...@so...]=20
Sent: Thursday, September 16, 2004 1:00 PM
To: spr...@li...
Cc: us...@os...
Subject: [Opensymphony-oscache] RE: [Springframework-developer] oscache
Glad to hear people are still thinking about OSCache. I wonder about
the comment made about the "weak configuration". I am actively
contributing to it right now and would love any input on it.
As far as a pluggable cache system goes, I think hibernate's model works
fairly well and I would like to see something like that in Spring.
One selfish question, I researched all the other open source caches out
there; however, I found them all to be immature except OSCache. Is
there a reason you are considering EHCache instead? I have asked this
question in many forums but can never get any answer.
> -----Original Message-----
> From: spr...@li...
> [mailto:spr...@li...] On
Behalf
> Of Rob Harrop
> Sent: Thursday, September 16, 2004 6:59 AM
> To: spr...@li...
> Subject: Re: [Springframework-developer] oscache
>=20
> I think the ability to support multiple caching implementations is a=20
> good idea. I think it is unlikely that there is a solution that is out
> and out the best for any given scenario.
>=20
> Rob
>=20
> Dmitriy Kopylenko wrote:
>=20
> > We're planning to use EHCache and I'm planning to write convenience=20
> > EhCacheFactoryBean for easy configuration and injection of EHCache=20
> > Caches using DI in Spring app context. May be it would make sense to
> > create a "cache" package to write integrations/support/convenient=20
> > configuration...you name it, for different caching systems i.e.=20
> > OSCache...
> >
> > What does everyone think?
> >
> > Regards,
> > Dmitriy.
> >
> >
> > bryan wrote:
> >
> >> Has any work been done or is any work planned to integrate oscach=20
> >> with the spring framework ? It is a great product but suffers from
a
> >> weak configuration system.
> >>
> >> --b
> >>
> >>
> >> -------------------------------------------------------
> >> This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170=20
> >> Project Admins to receive an Apple iPod Mini FREE for your
judgement on
> >> who ports your project to Linux PPC the best. Sponsored by IBM.
> >> Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php=20
> >> _______________________________________________
> >> Springframework-developer mailing list=20
> >> Spr...@li...
> >>
https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >>
> >>
> >
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170=20
> > Project Admins to receive an Apple iPod Mini FREE for your judgement
on
> > who ports your project to Linux PPC the best. Sponsored by IBM.
> > Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php=20
> > _______________________________________________
> > Springframework-developer mailing list=20
> > Spr...@li...
> >
https://lists.sourceforge.net/lists/listinfo/springframework-developer
> >
> >
>=20
>=20
> -------------------------------------------------------
> This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170=20
> Project Admins to receive an Apple iPod Mini FREE for your judgement
on
> who ports your project to Linux PPC the best. Sponsored by IBM.
> Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php=20
> _______________________________________________
> Springframework-developer mailing list=20
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
---------------------------------------------------------------------
To unsubscribe, e-mail: use...@os...
For additional commands, e-mail: use...@os...
|