Hi,
I am very new to ignite,I am working around the examples.
I have used cache store factory to load the data from sql server database to
ignite which is configured with native persistence
This is my code:
public String getData(String query, String key) throws Exception
{
String value = "";
Ignite ignite = Ignition.ignite();
String CACHE_NAME = key+"_schemas";
IgniteCache<String, EntitySchemas> cache=
ignite.cache(CACHE_NAME);
if(cache==null||cache.size()==0)
{
IgniteCache<String,EntitySchemas> schemasCache =
createCacheForSchema(key,CacheAtomicityMode.ATOMIC);
schemasCache.loadCache(null);
}
IgniteQueryService service = new IgniteQueryService();
String result = service.query(CACHE_NAME,query);
return result;
}
private IgniteCache<String, EntitySchemas> createCacheForSchema(String key,
CacheAtomicityMode atomic) throws Exception {
Ignite ignite = Ignition.ignite();
String CACHE_NAME = key+"_schemas";
CacheConfiguration cacheCfg = new
CacheConfiguration(CACHE_NAME);
cacheCfg.setReadThrough(true);
cacheCfg.setWriteThrough(true);
cacheCfg.setCacheMode(CacheMode.PARTITIONED); // Default.
cacheCfg.setIndexedTypes(String.class, EntitySchemas.class);
cacheCfg.setAtomicityMode(atomic);
// get sql connection
String connectionString = getSqlConnection(key, atomic);
// Configure store
cacheCfg.setCacheStoreFactory(new
DataCacheStoreFactory(connectionString));
cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
return ignite.getOrCreateCache(cacheCfg);
}
Here are my questions:
1. Is this right way to do?
Because I am using ignite with native persistence enabled but I am using
third party database to load data from database..?
2. What will be the performance issue because it will write in both file
system by ignite native persistence and into sql database by third party
database.?
and so,,,,
Thanks
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/