Search code examples
javacachingpersistenceignite

Different Data Models in In-Memory Cache and In Persistence Layer in Apache Ignite Data Grid


In apache ignite data grid, it has read-through and write through features that means if I update anything in in-memory layer, eventually the update will be written in persistence layer. It works perfectly if I have same data model in both of the in-memory and persistence layer. But I want to have two different model in in-memory cache and persistence layer and want it to have data grid like behavior. If I update anything in the in-memory, I want to have this update written in specific part of persistence layer.

I have gone through the documentation and found out about the custom CacheStore implementation but not sure how to achieve the above requirement.


Solution

  • I think custom CacheStore might help you here, check this Implementing Custom Cache Store docs.

    As the documentation suggests, it's better to start with CacheStoreAdapter<K, V> and implement the load and write methods just the way you like.