/**
   * @param ignite Ignite instance.
   * @param ccfg Cache configuration.
   * @return Data transfer object for cache store configuration properties.
   */
  public static VisorCacheStoreConfiguration from(Ignite ignite, CacheConfiguration ccfg) {
    VisorCacheStoreConfiguration cfg = new VisorCacheStoreConfiguration();

    GridCacheAdapter<Object, Object> c = ((IgniteKernal) ignite).internalCache(ccfg.getName());

    CacheStore store =
        c != null && c.context().started() ? c.context().store().configuredStore() : null;

    cfg.jdbcStore = store instanceof CacheAbstractJdbcStore;

    cfg.store = compactClass(store);
    cfg.storeFactory = compactClass(ccfg.getCacheStoreFactory());

    cfg.readThrough = ccfg.isReadThrough();
    cfg.writeThrough = ccfg.isWriteThrough();

    cfg.writeBehindEnabled = ccfg.isWriteBehindEnabled();
    cfg.batchSz = ccfg.getWriteBehindBatchSize();
    cfg.flushFreq = ccfg.getWriteBehindFlushFrequency();
    cfg.flushSz = ccfg.getWriteBehindFlushSize();
    cfg.flushThreadCnt = ccfg.getWriteBehindFlushThreadCount();

    return cfg;
  }
  /** {@inheritDoc} */
  @SuppressWarnings("unchecked")
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(gridName);

    TransactionConfiguration txCfg = c.getTransactionConfiguration();

    txCfg.setDefaultTxConcurrency(txConcurrency);
    txCfg.setDefaultTxIsolation(txIsolation);
    txCfg.setTxSerializableEnabled(true);

    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setCacheMode(cacheMode());
    cc.setAtomicityMode(TRANSACTIONAL);

    cc.setSwapEnabled(false);

    cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);

    cc.setEvictionPolicy(plc);
    cc.setEvictSynchronizedKeyBufferSize(1);

    cc.setEvictSynchronized(true);

    if (testStore != null) {
      cc.setCacheStoreFactory(singletonFactory(testStore));
      cc.setReadThrough(true);
      cc.setWriteThrough(true);
      cc.setLoadPreviousValue(true);
    } else cc.setCacheStoreFactory(null);

    c.setCacheConfiguration(cc);

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    disco.setIpFinder(ipFinder);

    c.setDiscoverySpi(disco);

    return c;
  }