Are you asking how you can configure Coherence to cache data from a DB - i.e. your C++ client does a get/put and Coherence reads or writes that data to the DB?
In that case I am afraid you will need to write some Java code. As Coherence server side is Java then anything that runs on the server side must be written in Java. Coherence cannot automatically know how to read and write to a given DB and convert that data into cached objects, you need to write code to do that and this code runs on the storage enabled members of the cluster, not on the C++ client. See the documentation here: http://docs.oracle.com/cd/E24290_01/coh.371/e22837/cache_rtwtwbra.htm#CFHEJHCI
yes.. JK that is what I am asking for. I have completed caching the data to coherence and then I thought I need some configurations for that data to be moved to DB (or) some API calls. I have gone through the link. That means on the server side I need a CacheStore which takes cached data from client and then pushes to the DB, but that needs to be in Java. Am I right?
Yes you are correct. You need to write a CacheStore implementation in Java and then put this in the cache configuration file. There are some things to be aware of though, for example, it is good to use a connection pool for connections in the CacheStore as you get one CacheStore implementation per cache per storage node, which can lead to a lot of DB connections in a big cluster with a lot of caches.
thanks JK.. one quick question.
I am able to write two structures which represent two tables into cache named sample and I am able to retrieve them back aslo.
But my doubt does the same thing apply while writing into DB from cache also?
Is the same cache valid to write into the DB for two different tables. Can we configure corresponding structure to table in configurations on the server side?
Or do we need a cache per table?
Your CacheStore is passed the value that needs to be written. As you have to write code for the methods in the CacheStore, then as long as your code can tell from the value which table it has to go to then you can write whatever DB access code you want. There are no restrictions on how you map the cached data to the DB as you control that code.
Another point I didn't mention - you cannot really have referential integrity constraints between data in different caches (or even entries in the same cache) as Coherence is a distributed system there is no transaction that spans the whole cache or multiple caches, so each value is written to the DB individually and you cannot really guarantee ordering.