This discussion is archived
1 Reply Latest reply: Feb 14, 2013 12:07 AM by Jonathan.Knight RSS

Coherence cache expiry-delay problem

867456 Newbie
Currently Being Moderated
Hi. I am tryin to have a cache which will delete inatsnces after 24 hours if they have not been read or updated. So I did configuration like this:

<?xml version="1.0" encoding="UTF-8"?>
<cache-config>
<caching-scheme-mapping>
<cache-mapping>
<cache-name>subscriberinfo</cache-name>
<scheme-name>distributed-scheme</scheme-name>
</cache-mapping>
</caching-scheme-mapping>

<caching-schemes>

<distributed-scheme>
<scheme-name>distributed-scheme</scheme-name>
<lease-granularity>member</lease-granularity>
<service-name>DistributedCache</service-name>
<serializer>
     <instance>
     <class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
     <init-params>
     <init-param>
          <param-type>String</param-type>
          <param-value>rbm-shovel-pof-config.xml</param-value>
     </init-param>
     </init-params>
     </instance>
     </serializer>
<backing-map-scheme>
<local-scheme>
     <unit-calculator>BINARY</unit-calculator>
     <expiry-delay>24h</expiry-delay>
     <flush-delay>180</flush-delay>
</local-scheme>
</backing-map-scheme>
<autostart>true</autostart>
</distributed-scheme>
</caching-schemes>
</cache-config>


But the thing is, it cleans the cache items even they have been used in recent 24 hours or updated. SO my cache shrinks. What can be the reason of it? By the way, I am making a bulk update with this:

cache.invokeAll(mapBuffer.keySet(), new ConditionalPutAll(AlwaysFilter.INSTANCE, mapBuffer));

So I am sure about that 99 percent of my items are updated.
  • 1. Re: Coherence cache expiry-delay problem
    Jonathan.Knight Expert
    Currently Being Moderated
    Hi,

    Setting the expiry time sets the time-to-live of entries put into the cache, so in your case an entry will live in the cache for at least 24 hours after it has been put. Reading the entry will not reset this time, it is just based on the time the entry was originally put in the cache. An update should reset the TTL, as this is equivalent of another put.

    JK

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points