Scenario: Java API of setTimeToLive(int seconds) can be called on com.ibm.websphere.cache.DistributedMap that is looked up from JNDI resource configured in WebSphere App server 6.1 on z/OS. For example, consider that two separate JNDI resources that are configured in WebSphere App Server as one_hour_cache and one_day_cache. These two JNDI resources are looked up in the Java Code as distMapOneHourCache and distMapOneDayCache respectively. It is possible to use the Java API as:
Questions: 1. Please verify that the setTimeToLive(int seconds) API means that an element placed in that cache will live for the specified number of seconds.
2. Does the setTimeToLive(int seconds) API successfully work in WebSphere App Server 6.1 in z/OS? Is there any specific patch or version needed for this API to work? I saw some postings on APAR fixes on this under: http://www-01.ibm.com/support/docview.wss?rs=180&uid=swg1PK41845
3. Instead of using the API of setTimeToLive(int seconds) in the Java code (after looking up the JNDI resource), is it possible to configure this time to live setting in the WebSphere App Server console? For example, set the value as 3600 for one_hour_cache JNDI resource in the WebSphere AppServer console only, instead of coding for it in the Java program. Which panel(s) in the App server Console will allow us to do this setting, instead of coding for it in the Java code?
4. Does timeToLive(int second) in the Java API gets reset, if the element in the cache is looked up? For example, an element (e.g., e1) is in the one_hour_cache. That element e1 is looked up at 10:05AM using the distMapOneHourCache.get(Object) API. That means, its timeToLive will expire at 11:06AM. However, if e1 is looked up again at 10:30 AM using the distMapOneHourCache.get(Object) API, does the clock get reset for ONLY e1 and e1 lives in the one_hour_cache for 1 more hour, till 11:31 AM? Is it correct that the time to live for an element in the cache gets reset, every time the element is looked up from the cache using get(Object) API?
5. If the distMapOneHourCache.containsKey(Object), or distMapOneHourCache.containsValue(Object) API are used to look up the element e1, does the time to live for e1 in the one_hour_cache also gets reset for one more hour, till it is touched again?
6. Consider that an element in the distributed cache is expired. Does that mean that the element in the cache is also removed? The reason I ask this question is because, some (open source cache e.g. ehcache) invalidates the cache at times and removes later.