1.如何在聚集模式下處理裂腦場景?持久性和分裂大腦場景
2. putAll的情況下,它是否打到每個條目的持久性存儲或一切都立刻被放入存儲?
3.如果我們設置批量大小,putAll將如何處理持久性商店?
4.如果使用備份分區,數據移動的順序是什麼? primary-> backup-> persistence或primary-> backup同時異步進入持久化?
5.如果一個更新的持久存儲做,什麼必須做,以反映它在緩存中沒有重裝?(如何處理後端更新)
6.On在後臺做的更新並且如果我們使用loadCache重載緩存來反映緩存中的變化,那麼這些變化不會在緩存中更新,或者如果我們直接使用get(),那麼更新也不會反映出來。只有在清除一次緩存然後調用loadcache或獲取api後纔會反映更新。這是重新加載緩存的正確方法嗎?
Person p1 = new Person(1, "Benakaraj", "KS", 11, 26, 1000);
Person p2 = new Person(2, "Ashwin", "Konale", 13, 26, 10000);
Connection con = null;
Statement stmt = null;
con = ds.getConnection();
stmt = con.createStatement();
String sql =
"create table Person(per_id int,name varchar(20),last_name varchar(20),org_id int,age int,salary REAL,primary key(per_id))";
stmt.executeUpdate(sql);
ROCCacheConfiguration<Integer, Person> pesonConfig = new ROCCacheConfiguration<>();
pesonConfig.setName("bkendupdtCache");
pesonConfig.setCacheMode(CacheMode.PARTITIONED);
JdbcType jdbcType = new JdbcType();
jdbcType.setCacheName("bkendupdtCache");
jdbcType.setDatabaseSchema("ROC4Test");
jdbcType.setDatabaseTable("Person");
jdbcType.setKeyType(Integer.class);
jdbcType.setValueType(Person.class);
// Key fields for PERSON.
Collection<JdbcTypeField> keys = new ArrayList<>();
keys.add(new JdbcTypeField(Types.INTEGER, "per_id", int.class, "perId"));
jdbcType.setKeyFields(keys.toArray(new JdbcTypeField[keys.size()]));
// Value fields for PERSON.
Collection<JdbcTypeField> vals = new ArrayList<>();
vals.add(new JdbcTypeField(Types.INTEGER, "per_id", int.class, "perId"));
vals.add(new JdbcTypeField(Types.VARCHAR, "name", String.class, "name"));
vals.add(new JdbcTypeField(Types.VARCHAR, "last_name", String.class, "lastName"));
vals.add(new JdbcTypeField(Types.INTEGER, "org_id", int.class, "orgId"));
vals.add(new JdbcTypeField(Types.INTEGER, "age", int.class, "age"));
vals.add(new JdbcTypeField(Types.FLOAT, "salary", Float.class, "salary"));
jdbcType.setValueFields(vals.toArray(new JdbcTypeField[vals.size()]));
Collection<JdbcType> jdbcTypes = new ArrayList<>();
jdbcTypes.add(jdbcType);
CacheJdbcPojoStoreFactory<Integer, Organization> cacheJdbcdPojoStorefactory4 =
context.getBean(CacheJdbcPojoStoreFactory.class);
cacheJdbcdPojoStorefactory4.setTypes(jdbcTypes.toArray(new JdbcType[jdbcTypes.size()]));
pesonConfig.setCacheStoreFactory((Factory<? extends CacheStore<Integer, Person>>) cacheJdbcdPojoStorefactory4);
pesonConfig.setReadThrough(true);
pesonConfig.setWriteThrough(true);
ROCCache<Integer, Person> personCache2 = rocCachemanager.createCache(pesonConfig);
personCache2.put(1, p1);
personCache2.put(2, p2);
assertEquals(personCache2.get(2).getName(), "Ashwin");
sql = assertEquals(personCache2.get(2).getName(), "Abhi");
"update Person set name='Abhi' where per_id=2";
stmt.execute(sql);
//fails and asks for assertion with the stale value
personCache.loadcache(null);
assertEquals(personCache2.get(2).getName(), "Abhi");
//works fine
personCache2.clear(2);
assertEquals(personCache2.get(2).getName(), "Abhi");
//works fine
personCache2.clear();
personCache2.loadcache(null);
assertEquals(personCache2.get(2).getName(), "Abhi");
sql = "drop table Person";
stmt.executeUpdate(sql);
con.close();
stmt.close();
rocCachemanager.destroyCache("bkendupdtCache");
通過批量我的意思是條目的數量到緩存中同時 –
在寫?備份是否仍然會異步更新? –
有關批量更新的更新響應。 –