如何防止 hazelcast MapStore 在存储之前加载条目
How to prevent hazelcast MapStore to load entries before store
根据 specification 使用直写模式 Hazelcast 时执行以下操作:
MapStore can be configured to be write-through by setting the
write-delay-seconds property to 0. This means the entries will be put
to the data store synchronously.
In this mode, when the map.put(key,value) call returns:
MapStore.store(key,value) is successfully called so the entry is
persisted. In-Memory entry is updated. In-Memory backup copies are
successfully created on other cluster members (if backup-count is
greater than 0).
但实际上它在存储每个条目之前执行 MapStore.load(key)。 IMap 的配置如下:
Config config = ...
MapConfig mapConfig = config.getMapConfig("data-" + id);
MapStoreConfig mapStoreConfig = mapConfig.getMapStoreConfig();
mapStoreConfig.setEnabled(true);
mapStoreConfig.setImplementation(new RecordsMapStore());
mapStoreConfig.setWriteDelaySeconds(0);
config.addMapConfig(mapConfig);
如何防止这样的负载?
尝试使用map.set()
以避免加载
根据 specification 使用直写模式 Hazelcast 时执行以下操作:
MapStore can be configured to be write-through by setting the write-delay-seconds property to 0. This means the entries will be put to the data store synchronously.
In this mode, when the map.put(key,value) call returns:
MapStore.store(key,value) is successfully called so the entry is persisted. In-Memory entry is updated. In-Memory backup copies are successfully created on other cluster members (if backup-count is greater than 0).
但实际上它在存储每个条目之前执行 MapStore.load(key)。 IMap 的配置如下:
Config config = ...
MapConfig mapConfig = config.getMapConfig("data-" + id);
MapStoreConfig mapStoreConfig = mapConfig.getMapStoreConfig();
mapStoreConfig.setEnabled(true);
mapStoreConfig.setImplementation(new RecordsMapStore());
mapStoreConfig.setWriteDelaySeconds(0);
config.addMapConfig(mapConfig);
如何防止这样的负载?
尝试使用map.set()
以避免加载