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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 14, 2004 5:41 PM
> To: [EMAIL PROTECTED]
> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to