You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Akash Shinde <ak...@gmail.com> on 2020/05/12 16:48:31 UTC

Reloading of cache not working

Hi,
I am using ignite 2.6. I am trying refresh few caches which are already
loaded during server startup using cache loaders.
To refresh caches I am invoking IgniteCache.loadCache method. But it seems
that it is not updating data in caches.
1) Is it the expected behavior?
2) Do I have to clear the cache before calling IgniteCache.loadCache method
to refresh the cache ?
3) Does the clo.apply(key, data) (invoked from CacheStoreAdapter.loadCache
method) updates the cache only for the keys which are not already present
in cache?

Thanks,
Akash

Re: Reloading of cache not working

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

Yes, as it was mentioned on the list, it is not going to replace already
existing keys' values.

Regards,
-- 
Ilya Kasnacheev


ср, 13 мая 2020 г. в 08:01, Akash Shinde <ak...@gmail.com>:

> Hi,
> My question is specifically for clo.apply(key, data)  that I invoked in CacheStoreAdapter.loadCache
> method.
> So, does this method (clo.apply) overrides value for the keys which are
> already present in cache or it just skips?
> My observation is that its not overriding value for the keys which are
> already present and adding data for only new keys.
>
> Thanks,
> Akash
>
> On Wed, May 13, 2020 at 1:15 AM akorensh <al...@gmail.com> wrote:
>
>> Hi,
>> 1)  loadCache() is implementation dependent, by default it just adds new
>> records to the cache .
>>   see example:
>>
>> https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java
>>
>>
>>   Take a look at jdbc example as well:
>>
>> https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
>>
>>   more info:
>> https://apacheignite.readme.io/docs/data-loading#ignitecacheloadcache
>>
>> 2) You do not need to clear the cache in order to call loadCache
>>
>> 3)  This is implementation dependent.   By default it does not overwrite
>> existing entries.
>>
>> you can experiment w/the above examples by putting:
>>   cache.put(1L,new Person(1L,"A", "B") ) before the loadCache() statement
>> to
>> get a better feel for its behavior.
>>
>> Thanks, Alex
>>
>>
>>
>>
>>
>> --
>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>
>

Re: Reloading of cache not working

Posted by Akash Shinde <ak...@gmail.com>.
Hi,
My question is specifically for clo.apply(key, data)  that I invoked
in CacheStoreAdapter.loadCache
method.
So, does this method (clo.apply) overrides value for the keys which are
already present in cache or it just skips?
My observation is that its not overriding value for the keys which are
already present and adding data for only new keys.

Thanks,
Akash

On Wed, May 13, 2020 at 1:15 AM akorensh <al...@gmail.com> wrote:

> Hi,
> 1)  loadCache() is implementation dependent, by default it just adds new
> records to the cache .
>   see example:
>
> https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java
>
>
>   Take a look at jdbc example as well:
>
> https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java
>
>   more info:
> https://apacheignite.readme.io/docs/data-loading#ignitecacheloadcache
>
> 2) You do not need to clear the cache in order to call loadCache
>
> 3)  This is implementation dependent.   By default it does not overwrite
> existing entries.
>
> you can experiment w/the above examples by putting:
>   cache.put(1L,new Person(1L,"A", "B") ) before the loadCache() statement
> to
> get a better feel for its behavior.
>
> Thanks, Alex
>
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: Reloading of cache not working

Posted by akorensh <al...@gmail.com>.
Hi,
1)  loadCache() is implementation dependent, by default it just adds new
records to the cache .
  see example:
https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/datagrid/store/CacheLoadOnlyStoreExample.java


  Take a look at jdbc example as well:
https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java

  more info:
https://apacheignite.readme.io/docs/data-loading#ignitecacheloadcache

2) You do not need to clear the cache in order to call loadCache

3)  This is implementation dependent.   By default it does not overwrite
existing entries.

you can experiment w/the above examples by putting:                 
  cache.put(1L,new Person(1L,"A", "B") ) before the loadCache() statement to
get a better feel for its behavior.

Thanks, Alex





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/