What I am trying to accomplish is to set up both TTL (time to live) and TTI (time to idle) for a cache, so that the key either expires after TTL time or it can be expired earlier in case in hasn't been accessed for TTI period.
In Ehcache 2 it was possible with the following configuration:
<cache name="my.custom.Cache"
timeToIdleSeconds="10"
timeToLiveSeconds="120">
</cache>In Ehcache 3 the analogous configuration block looks like the following:
<cache alias="my.custom.Cache">
<expiry>
<tti unit="seconds">10</tti>
<ttl unit="minutes">2</ttl>
</expiry>
</cache>The problem is that such configuration is considered invalid since ehcache.xsd states that there should only be one option under expiry tag (either tti or ttl, but not both).
--
You received this message because you are subscribed to the Google Groups "ehcache-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ehcache-user...@googlegroups.com.
To post to this group, send email to ehcach...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ehcache-users/4bdb5ba7-6ef2-48e8-b674-db2d02ade262%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/ehcache-users/c6fd1a68-536a-4715-a271-afa2fd7cc2c8%40googlegroups.com.
<cache alias="my.custom.Cache">
<expiry>
<class>my.custom.CacheExpiry</class>
</expiry>
</cache>package my.custom;
import javax.cache.expiry.Duration;
import javax.cache.expiry.ExpiryPolicy;
import java.util.concurrent.TimeUnit;
public class CacheExpiry implements ExpiryPolicy
{
private static final Duration TWO_MINUTES = new Duration( TimeUnit.MINUTES, 2 );
@Override
public Duration getExpiryForCreation()
{
return Duration.ONE_MINUTE;
}
@Override
public Duration getExpiryForAccess()
{
return TWO_MINUTES;
}
@Override
public Duration getExpiryForUpdate()
{
return TWO_MINUTES;
}
}
To view this discussion on the web visit https://groups.google.com/d/msgid/ehcache-users/6a077ff2-74b2-45f4-80c3-7a0e4553e988%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ehcache-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ehcache-users/6a077ff2-74b2-45f4-80c3-7a0e4553e988%40googlegroups.com.
Is BillingUsageExpiry implementing org.ehcache.expiry.Expiry?
To view this discussion on the web visit https://groups.google.com/d/msgid/ehcache-users/69f8dd11-a390-4c06-b233-32577a3cd830%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ehcache-users+unsubscribe@googlegroups.com.
To post to this group, send email to ehcach...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ehcache-users/69f8dd11-a390-4c06-b233-32577a3cd830%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "ehcache-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ehcache-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ehcache-users/CANjx1tU7NquZz2fr1zOZ8P%3DgxaHER4ohzuxgS%2BZ%2B1hoizE2p%3Dw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ehcache-users/69f8dd11-a390-4c06-b233-32577a3cd830%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "ehcache-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ehcache-user...@googlegroups.com.
To post to this group, send email to ehcach...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ehcache-users/8c01289c-58c5-430c-9ce6-1ecb5d8683c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.