/** * Reads the near config. * * @param in Stream. * @return NearCacheConfiguration. */ public static NearCacheConfiguration readNearConfiguration(BinaryRawReader in) { NearCacheConfiguration cfg = new NearCacheConfiguration(); cfg.setNearStartSize(in.readInt()); cfg.setNearEvictionPolicy(readEvictionPolicy(in)); return cfg; }
/** */ private CacheConfiguration buildCacheConfiguration(CacheMode mode, CacheAtomicityMode atomicityMode, boolean hasNear, boolean writeThrough, boolean notNullAnnotated) { CacheConfiguration cfg = new CacheConfiguration(CACHE_PREFIX + "-" + mode.name() + "-" + atomicityMode.name() + (hasNear ? "-near" : "") + (writeThrough ? "-writethrough" : "") + (notNullAnnotated ? "-annot" : "")); cfg.setCacheMode(mode); cfg.setAtomicityMode(atomicityMode); cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); QueryEntity qe = new QueryEntity(new QueryEntity(Integer.class, Person.class)); if (!notNullAnnotated) qe.setNotNullFields(Collections.singleton("name")); cfg.setQueryEntities(F.asList(qe)); if (hasNear) cfg.setNearConfiguration(new NearCacheConfiguration().setNearStartSize(100)); if (writeThrough) { cfg.setCacheStoreFactory(singletonFactory(new TestStore())); cfg.setWriteThrough(true); } return cfg; }
/** * Reads the near config. * * @param in Stream. * @return NearCacheConfiguration. */ public static NearCacheConfiguration readNearConfiguration(BinaryRawReader in) { NearCacheConfiguration cfg = new NearCacheConfiguration(); cfg.setNearStartSize(in.readInt()); cfg.setNearEvictionPolicy(readEvictionPolicy(in)); return cfg; }