Update:
I wrote a small test with TouchedExpiryPolicy as below, I am putting an Object
of DocumentCacheDto in cache with TouchedExpiryPolicy set to 10 secs.
Thereafter I am accessing the same value after 8secs
And even the cache entry is being touched by using get() the entry disappears
after 10 secs. So why is TouchedExpiryPolicy is not renewing the expiry time of
the cache entry..?
private void test() {
documentCache.withExpiryPolicy(new TouchedExpiryPolicy(new
Duration(MILLISECONDS, 10000))).put(1L, new
DocumentCacheDto().searchToken("111"));
try {
System.out.println(new Date() +", "+ documentCache.get(1L));
Thread.sleep(8000);
System.out.println(new Date() +", "+documentCache.get(1L));
Thread.sleep(8000);
System.out.println(new Date() +", "+ documentCache.get(1L));
Thread.sleep(8000);
System.out.println(new Date() +", "+documentCache.get(1L));
}catch(Exception e) {}
}
Output:
Fri May 18 16:42:45 AEST 2018, DocumentCacheDto [searchToken=111,
documentKey=0, document=null, expiryTime=null]
Fri May 18 16:42:53 AEST 2018, DocumentCacheDto [searchToken=111,
documentKey=0, document=null, expiryTime=null]
Fri May 18 16:43:01 AEST 2018, null
Fri May 18 16:43:09 AEST 2018, null
________________________________
From: Shaleen Sharma <[email protected]>
Sent: Friday, 18 May 2018 3:37 PM
To: [email protected]
Subject: AccessedExpirationPolicy with SQL
Hi
I am using AccessedExpiryPolicy in my cache setup. I am setting the data in
cache using the usual ‘put ‘ method but I am retrieving the data using
SqlFieldsQuery. In this setup the expiration policy only considers the time of
data creation and hence the data gets expired after the time from the data
creation completes. It doesn’t consider the data accessed and doesn’t renew the
expiration time since the data was last accessed.
Do the ExpirationPolicies not consider the data access using Ignite SQL or am
I missing something ?
Thanks
Shaleen