jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ankur.ku...@axa.com.au
Subject RE: Time To Live Configuration for Invididual Cache Item
Date Thu, 15 Jan 2004 01:04:44 GMT
Thanks!! It works.


Please respond to "Turbine JCS Users List" 
<turbine-jcs-user@jakarta.apache.org>
To:     'Turbine JCS Users List' <turbine-jcs-user@jakarta.apache.org>
cc: 

Subject:        RE: Time To Live Configuration for Invididual Cache Item

You are creating a new ElementAtrributes object, which probably defaults
to isEternal=true.  If that is the case, it may never expire.

Try getting the default for the region and then modifying it.  Something
like this should work:

JCS cache = getCacheForRegion(regionName);
          ElementAttributes attr = cache.getElementAttributes().copy();
          attr.setMaxLifeSeconds(10);
          cache.put(name, obj, attr);


Aaron

> -----Original Message-----
> From: ankur.kumar@axa.com.au [mailto:ankur.kumar@axa.com.au]
> Sent: Wednesday, January 14, 2004 5:41 PM
> To: turbine-jcs-user@jakarta.apache.org
> Subject: Time To Live Configuration for Invididual Cache Item
> 
> I'm setting "time to live" value for an individual cache item, but it
> doesn't work and it takes TTL value set for that Cache Region in which
> cache item is added.
> So, in this scenraio, cache item expires after "100" secs whereas I
set to
> expire after "10" secs.
> 
> Here is code snippet which is putting cache item:
> .............
>          JCS cache = getCacheForRegion(regionName);
>          ElementAttributes attr = new ElementAttributes();
>          attr.setMaxLifeSeconds(10);
>          cache.put(name, obj, attr);
> ................
> 
> 
> and here is cache.ccf settings:
> 
> # DEFAULT CACHE REGION
> 
> # sets the default aux value for any non configured caches
> jcs.default=
>
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttribut
es
> jcs.default.cacheattributes.MaxObjects=100
>
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory
.l
> ru.LRUMemoryCache
> jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes
> jcs.default.elementattributes.IsEternal=false
> jcs.default.elementattributes.MaxLifeSeconds=1000
> jcs.default.elementattributes.IdleTime=1
> jcs.default.elementattributes.IsSpool=false
> jcs.default.elementattributes.IsRemote=false
> jcs.default.elementattributes.IsLateral=false
> 
> 
> # LRU Memory Cache
> jcs.region.eplatform_primary_memory_cache=
>
jcs.region.eplatform_primary_memory_cache.cacheattributes=org.apache.jcs
.e
> ngine.CompositeCacheAttributes
>
jcs.region.eplatform_primary_memory_cache.cacheattributes.MaxObjects=100
00
> 0
>
jcs.region.eplatform_primary_memory_cache.cacheattributes.MemoryCacheNam
e=
> org.apache.jcs.engine.memory.lru.LRUMemoryCache
>
jcs.region.eplatform_primary_memory_cache.elementattributes=org.apache.j
cs
> .engine.ElementAttributes
>
jcs.region.eplatform_primary_memory_cache.elementattributes.IsEternal=fa
ls
> e
>
jcs.region.eplatform_primary_memory_cache.elementattributes.MaxLifeSecon
ds
> =1000
> jcs.region.eplatform_primary_memory_cache.elementattributes.IdleTime=1
>
jcs.region.eplatform_primary_memory_cache.elementattributes.IsSpool=fals
e
>
jcs.region.eplatform_primary_memory_cache.elementattributes.IsRemote=fal
se
>
jcs.region.eplatform_primary_memory_cache.elementattributes.IsLateral=fa
ls
> e
> 
> 
> 
>
************************************************************************
**
> *******
> Important Note
> This email (including any attachments) contains information which is
> confidential and may be subject to legal privilege.  If you are not
> the intended recipient you must not use, distribute or copy this
> email.  If you have received this email in error please notify the
> sender immediately and delete this email. Any views expressed in this
> email are not necessarily the views of AXA.   Thank you.
>
************************************************************************
**
> *******



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-jcs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-jcs-user-help@jakarta.apache.org






*********************************************************************************
Important Note
This email (including any attachments) contains information which is 
confidential and may be subject to legal privilege.  If you are not 
the intended recipient you must not use, distribute or copy this 
email.  If you have received this email in error please notify the 
sender immediately and delete this email. Any views expressed in this 
email are not necessarily the views of AXA.   Thank you.
*********************************************************************************


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message