You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by John Smith <ja...@gmail.com> on 2020/05/07 16:45:28 UTC

Can you change ExpiryPolicy of existing cache?

Hi running 2.7.0

I created a cache with ModifiedExpiryPolicy

Can we change the policy of the created cache? I know we can do per write
but can we change the default of the existing cache to another policy?

Re: Can you change ExpiryPolicy of existing cache?

Posted by John Smith <ja...@gmail.com>.
Ok cool!

On Thu, 7 May 2020 at 13:46, Evgenii Zhuravlev <e....@gmail.com>
wrote:

> It's not changing the default Expiry Policy, you will have a new Expiry
> Policy as long as you use this "cache" object. withExpiryPolivy return
> proxy with a new policy, so, all objects that were inserted using this
> "cache" object, will have a new policy.
>
> Evgenii
>
> чт, 7 мая 2020 г. в 10:39, John Smith <ja...@gmail.com>:
>
>> Ok cool. I create my cache using a template and the rest API, but when I
>> start my application I do...
>>
>> cache = this.ignite.cache(this.cacheName)
>>         .withExpiryPolicy(new ModifiedExpiryPolicy(new Duration(timeUnit, this.cacheTtlDuration)));
>>
>> Can it be changed then at startup as am doing above?
>>
>> Or at this point I can only do cache.withExpiryPolicy(...).put(key,
>> value);
>>
>>
>> On Thu, 7 May 2020 at 13:31, Evgenii Zhuravlev <e....@gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> There is no way to change the default policy for the already created
>>> cache. The expiry policy can be changed for all operations on one cache
>>> proxy object using withExpiryPolicy.
>>>
>>> Evgenii
>>>
>>> чт, 7 мая 2020 г. в 09:46, John Smith <ja...@gmail.com>:
>>>
>>>> Hi running 2.7.0
>>>>
>>>> I created a cache with ModifiedExpiryPolicy
>>>>
>>>> Can we change the policy of the created cache? I know we can do per
>>>> write but can we change the default of the existing cache to another policy?
>>>>
>>>

Re: Can you change ExpiryPolicy of existing cache?

Posted by Evgenii Zhuravlev <e....@gmail.com>.
It's not changing the default Expiry Policy, you will have a new Expiry
Policy as long as you use this "cache" object. withExpiryPolivy return
proxy with a new policy, so, all objects that were inserted using this
"cache" object, will have a new policy.

Evgenii

чт, 7 мая 2020 г. в 10:39, John Smith <ja...@gmail.com>:

> Ok cool. I create my cache using a template and the rest API, but when I
> start my application I do...
>
> cache = this.ignite.cache(this.cacheName)
>         .withExpiryPolicy(new ModifiedExpiryPolicy(new Duration(timeUnit, this.cacheTtlDuration)));
>
> Can it be changed then at startup as am doing above?
>
> Or at this point I can only do cache.withExpiryPolicy(...).put(key, value);
>
>
> On Thu, 7 May 2020 at 13:31, Evgenii Zhuravlev <e....@gmail.com>
> wrote:
>
>> Hi,
>>
>> There is no way to change the default policy for the already created
>> cache. The expiry policy can be changed for all operations on one cache
>> proxy object using withExpiryPolicy.
>>
>> Evgenii
>>
>> чт, 7 мая 2020 г. в 09:46, John Smith <ja...@gmail.com>:
>>
>>> Hi running 2.7.0
>>>
>>> I created a cache with ModifiedExpiryPolicy
>>>
>>> Can we change the policy of the created cache? I know we can do per
>>> write but can we change the default of the existing cache to another policy?
>>>
>>

Re: Can you change ExpiryPolicy of existing cache?

Posted by John Smith <ja...@gmail.com>.
Ok cool. I create my cache using a template and the rest API, but when I
start my application I do...

cache = this.ignite.cache(this.cacheName)
        .withExpiryPolicy(new ModifiedExpiryPolicy(new
Duration(timeUnit, this.cacheTtlDuration)));

Can it be changed then at startup as am doing above?

Or at this point I can only do cache.withExpiryPolicy(...).put(key, value);


On Thu, 7 May 2020 at 13:31, Evgenii Zhuravlev <e....@gmail.com>
wrote:

> Hi,
>
> There is no way to change the default policy for the already created
> cache. The expiry policy can be changed for all operations on one cache
> proxy object using withExpiryPolicy.
>
> Evgenii
>
> чт, 7 мая 2020 г. в 09:46, John Smith <ja...@gmail.com>:
>
>> Hi running 2.7.0
>>
>> I created a cache with ModifiedExpiryPolicy
>>
>> Can we change the policy of the created cache? I know we can do per write
>> but can we change the default of the existing cache to another policy?
>>
>

Re: Can you change ExpiryPolicy of existing cache?

Posted by Evgenii Zhuravlev <e....@gmail.com>.
Hi,

There is no way to change the default policy for the already created cache.
The expiry policy can be changed for all operations on one cache proxy
object using withExpiryPolicy.

Evgenii

чт, 7 мая 2020 г. в 09:46, John Smith <ja...@gmail.com>:

> Hi running 2.7.0
>
> I created a cache with ModifiedExpiryPolicy
>
> Can we change the policy of the created cache? I know we can do per write
> but can we change the default of the existing cache to another policy?
>