You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by "slava.koptilin" <sl...@gmail.com> on 2018/01/22 13:06:56 UTC

Re: CacheStoreAdapter write and delete are not being called by Ignite's GridCacheStoreManager

Hi Pim,

Well, you only configure CacheLoaderFactory which is used when a cache is
read-through or when loading data into a cache via the Cache#loadAll()
method.
So, you need to provide a CacheWriter implementation in order to enable
write-through behavior.
Please see, CacheConfiguration#setCacheWriterFactory().
Apache Ignite provides a convenient method
CacheConfiguration#setCacheStoreFactory() which allows specifying cache
store factory(please see CacheStore class). Something like as follows:
    CacheConfiguration cacheCfg = new CacheConfiguration();
    cacheCfg.setName("PlayerScores");
   
cacheCfg.setCacheStoreFactory(FactoryBuilder.factoryOf(PlayerScoreStoreAdapter.class));
    ...

Simple examples can be found here:
https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcPersonStore.java
https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/datagrid/store/jdbc/CacheJdbcStoreExample.java

Thanks,
Slava.



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

Re: CacheStoreAdapter write and delete are not being called by Ignite's GridCacheStoreManager

Posted by Pim D <pi...@ns.nl>.
Hi Slava,

Guess I overlooked that part, thanx!



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