是否可以像在Coherence中一样在Hazelcast中配置持久性存储的缓存?

时间:2019-05-09 09:03:27

标签: configuration hazelcast-imap oracle-coherence

当前,我正在从Coherence迁移到用于数据网格的Hazelcast,在将Coherence配置移植到Hazelcast时遇到了一些问题。 这是我当前的Coherence配置:

<cache-mapping>
    <cache-name>rlb_*</cache-name>
    <scheme-name>rlb</scheme-name>
</cache-mapping>
<near-scheme>
    <scheme-name>rlb</scheme-name>
    <front-scheme>
        <local-scheme>
            <scheme-ref>localL</scheme-ref>
        </local-scheme>
    </front-scheme>
    <back-scheme>
        <distributed-scheme>
            <scheme-ref>backing_store_wb</scheme-ref>
        </distributed-scheme>
    </back-scheme>
    <invalidation-strategy>auto</invalidation-strategy>
    <autostart>true</autostart>
</near-scheme>
<local-scheme>
    <scheme-name>localL</scheme-name>
    <eviction-policy>HYBRID</eviction-policy>
    <high-units>200m</high-units>
    <low-units>150m</low-units>
    <unit-calculator>FIXED</unit-calculator>
    <expiry-delay>1h</expiry-delay>
</local-scheme>
<distributed-scheme>
    <scheme-name>backing_store_wb</scheme-name>
    <service-name>DistributedCache</service-name>
    <thread-count>10</thread-count>
    <backup-count>1</backup-count>
    <backing-map-scheme>
        <read-write-backing-map-scheme>
            <scheme-name>PersistenceCallbackScheme</scheme-name>
            <internal-cache-scheme>
                <local-scheme>
                    <scheme-ref>localH</scheme-ref>
                </local-scheme>
            </internal-cache-scheme>
            <cachestore-scheme>
                <class-scheme>
                    <class-name>com.bossmedia.gp.space.coherence.cachestore.DelegateCacheStore</class-name>
                    <init-params>
                        <init-param>
                            <param-type>java.lang.String</param-type>
                            <param-value>{cache-name}</param-value>
                        </init-param>
                        <init-param>
                            <param-type>{cache-ref}</param-type>
                            <param-value>persistence_info_cache</param-value>
                        </init-param>
                    </init-params>
                </class-scheme>
            </cachestore-scheme>
            <write-delay>5s</write-delay>
            <write-batch-factor>0.2</write-batch-factor>
            <write-requeue-threshold>10</write-requeue-threshold>
        </read-write-backing-map-scheme>
    </backing-map-scheme>
    <autostart>true</autostart>
</distributed-scheme>

使用Hazelcast提供的迁移指南,我编写了以下Hazelcast配置:

<map name="READ_MOSTLY-MEDIUM-LOW-*">
    <backup-count>1</backup-count>
    <time-to-live-seconds>0</time-to-live-seconds>
    <max-idle-seconds>0</max-idle-seconds>
    <eviction-policy>NONE</eviction-policy>
    <map-store enabled="true">
        <factory-class-name>com.bossmedia.gp.space.hazelcast.mapstore.PersistenceCallbackMapStoreFactory</factory-class-name>
        <write-delay-seconds>5</write-delay-seconds>
        <properties><property name="template">READ_MOSTLY-MEDIUM-LOW-</property></properties>
    </map-store>
    <near-cache>
        <max-idle-seconds>0</max-idle-seconds>
        <time-to-live-seconds>3600</time-to-live-seconds>
        <max-size policy="PER_NODE">200m</max-size>
        <eviction-percentage>25</eviction-percentage>
        <eviction-policy>LRU</eviction-policy>
    </near-cache>
    <invalidate-on-change>true</invalidate-on-change>
</map>

我也想为备份映射配置缓存(因为它是在Coherence配置上完成的),但是我无法找到一种方法。 有没有办法配置它或Hazelcast不允许这种级别的配置?

0 个答案:

没有答案