Coherence 缓存逐出策略
Coherence Cache Eviction Policy
我有以下缓存配置文件,
我想为每个缓存映射添加 evcition 策略,假设
MY_SEND_SMS_SIZE_CACHE
中超过 5 分钟的数据
MY_REG_AUTH_CACHE
中超过 10 天的数据
将自动删除。
如何配置这个文件?
一致性缓存-config_imos.xml
<cache-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config"
xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-cache-config
coherence-cache-config.xsd">
<caching-scheme-mapping>
<cache-mapping>
<cache-name>MY_SEND_SMS_SIZE_CACHE</cache-name>
<scheme-name>MY_UserDistributedCache</scheme-name>
</cache-mapping>
<cache-mapping>
<cache-name>MY_REG_AUTH_CACHE</cache-name>
<scheme-name>MY_UserDistributedCache</scheme-name>
</cache-mapping>
</caching-scheme-mapping>
<caching-schemes>
<distributed-scheme>
<scheme-name>MY_UserDistributedCache</scheme-name>
<service-name>MY_UserDistributedCache</service-name>
<serializer>
<instance>
<class-name>com.tangosol.io.pof.SafeConfigurablePofContext
</class-name>
<init-params>
<init-param>
<param-type>String</param-type>
<param-value>
<!-- pof-config.xml path should be set -->
pof-config.xml
</param-value>
</init-param>
</init-params>
</instance>
</serializer>
<backing-map-scheme>
<local-scheme />
</backing-map-scheme>
<autostart>true</autostart>
</distributed-scheme>
</caching-schemes>
我已经按如下方式编辑了 conf 文件然后一切正常,我的意思是超过 10 秒的数据被驱逐
<caching-scheme-mapping>
<cache-mapping>
<cache-name>MY_SEND_SMS_SIZE_CACHE</cache-name>
<scheme-name>MY_UserDistributedCache</scheme-name>
</cache-mapping>
<cache-mapping>
<cache-name>MY_REG_AUTH_CACHE</cache-name>
<scheme-name>MY_UserDistributedCache</scheme-name>
</cache-mapping>
</caching-scheme-mapping>
<caching-schemes>
<distributed-scheme>
<scheme-name>MY_UserDistributedCache</scheme-name>
<service-name>MY_UserDistributedCache</service-name>
<serializer>
<instance>
<class-name>com.tangosol.io.pof.SafeConfigurablePofContext
</class-name>
<init-params>
<init-param>
<param-type>String</param-type>
<param-value>
<!-- pof-config.xml path should be set -->
pof-config.xml
</param-value>
</init-param>
</init-params>
</instance>
</serializer>
<backing-map-scheme>
<local-scheme>
<scheme-name>MY_REG_AUTH_CACHE</scheme-name>
<expiry-delay>10s</expiry-delay>
</local-scheme>
</backing-map-scheme>
<autostart>true</autostart>
</distributed-scheme>
</caching-schemes>
我有以下缓存配置文件, 我想为每个缓存映射添加 evcition 策略,假设
MY_SEND_SMS_SIZE_CACHE
MY_REG_AUTH_CACHE
将自动删除。
如何配置这个文件?
一致性缓存-config_imos.xml
<cache-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config"
xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-cache-config
coherence-cache-config.xsd">
<caching-scheme-mapping>
<cache-mapping>
<cache-name>MY_SEND_SMS_SIZE_CACHE</cache-name>
<scheme-name>MY_UserDistributedCache</scheme-name>
</cache-mapping>
<cache-mapping>
<cache-name>MY_REG_AUTH_CACHE</cache-name>
<scheme-name>MY_UserDistributedCache</scheme-name>
</cache-mapping>
</caching-scheme-mapping>
<caching-schemes>
<distributed-scheme>
<scheme-name>MY_UserDistributedCache</scheme-name>
<service-name>MY_UserDistributedCache</service-name>
<serializer>
<instance>
<class-name>com.tangosol.io.pof.SafeConfigurablePofContext
</class-name>
<init-params>
<init-param>
<param-type>String</param-type>
<param-value>
<!-- pof-config.xml path should be set -->
pof-config.xml
</param-value>
</init-param>
</init-params>
</instance>
</serializer>
<backing-map-scheme>
<local-scheme />
</backing-map-scheme>
<autostart>true</autostart>
</distributed-scheme>
</caching-schemes>
我已经按如下方式编辑了 conf 文件然后一切正常,我的意思是超过 10 秒的数据被驱逐
<caching-scheme-mapping>
<cache-mapping>
<cache-name>MY_SEND_SMS_SIZE_CACHE</cache-name>
<scheme-name>MY_UserDistributedCache</scheme-name>
</cache-mapping>
<cache-mapping>
<cache-name>MY_REG_AUTH_CACHE</cache-name>
<scheme-name>MY_UserDistributedCache</scheme-name>
</cache-mapping>
</caching-scheme-mapping>
<caching-schemes>
<distributed-scheme>
<scheme-name>MY_UserDistributedCache</scheme-name>
<service-name>MY_UserDistributedCache</service-name>
<serializer>
<instance>
<class-name>com.tangosol.io.pof.SafeConfigurablePofContext
</class-name>
<init-params>
<init-param>
<param-type>String</param-type>
<param-value>
<!-- pof-config.xml path should be set -->
pof-config.xml
</param-value>
</init-param>
</init-params>
</instance>
</serializer>
<backing-map-scheme>
<local-scheme>
<scheme-name>MY_REG_AUTH_CACHE</scheme-name>
<expiry-delay>10s</expiry-delay>
</local-scheme>
</backing-map-scheme>
<autostart>true</autostart>
</distributed-scheme>
</caching-schemes>