Reloading of cache not working

classic Classic list List threaded Threaded
4 messages Options
akash shinde akash shinde
Reply | Threaded
Open this post in threaded view
|

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
akorensh akorensh
Reply | Threaded
Open this post in threaded view
|

Re: Reloading of cache not working

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/
akash shinde akash shinde
Reply | Threaded
Open this post in threaded view
|

Re: Reloading of cache not working

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 <[hidden email]> 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/
ilya.kasnacheev ilya.kasnacheev
Reply | Threaded
Open this post in threaded view
|

Re: Reloading of cache not working

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 <[hidden email]>:
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 <[hidden email]> 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/