You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Shaleen Sharma <sh...@hotmail.com> on 2018/05/18 05:37:09 UTC

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








Re: AccessedExpirationPolicy with SQL

Posted by Denis Mekhanikov <dm...@gmail.com>.
Shaleen,

This is a known issue: https://issues.apache.org/jira/browse/IGNITE-7687
Judging by a comment in the ticket, it's not going to be fixed in the
nearest future.
Cache API works with TTL correctly, so if you strongly depend on the
expiration policy, you can move your access logic to cache API.

Denis


сб, 19 мая 2018 г. в 2:26, Shaleen Sharma <sh...@hotmail.com>:

> Is there any update on the below issue:
>
> Thanks
> Shaleen
>
>
>
> From: Shaleen Sharma
> Sent: Friday, 18 May, 5:00 pm
> Subject: Re: AccessedExpirationPolicy with SQL
> To: user@ignite.apache.org
>
>
>
> 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 <sh...@hotmail.com>
> *Sent:* Friday, 18 May 2018 3:37 PM
> *To:* user@ignite.apache.org
> *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
>
>
>
>
>
>
>
>
>
>

AccessedExpirationPolicy with SQL

Posted by Shaleen Sharma <sh...@hotmail.com>.
Is there any update on the below issue:

Thanks
Shaleen



From: Shaleen Sharma
Sent: Friday, 18 May, 5:00 pm
Subject: Re: AccessedExpirationPolicy with SQL
To: user@ignite.apache.org



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 <sh...@hotmail.com>
Sent: Friday, 18 May 2018 3:37 PM
To: user@ignite.apache.org
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










Re: AccessedExpirationPolicy with SQL

Posted by Shaleen Sharma <sh...@hotmail.com>.
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 <sh...@hotmail.com>
Sent: Friday, 18 May 2018 3:37 PM
To: user@ignite.apache.org
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