Apache Geode配置报错:<gfe:entry-ttl>等元素不可置于<replicated-region>下
问题解决:Apache Geode Replicated Region 过期配置错误
问题原因
在Spring Data Geode 2.7.2的XML Schema定义中,entry-ttl和entry-tti这类过期策略配置元素,不能直接作为<gfe:replicated-region>的子节点,必须嵌套在<gfe:expiration>容器内部,直接放置会触发XML结构校验失败。
修改后的正确配置
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:gfe="http://www.springframework.org/schema/geode" xsi:schemaLocation="http://www.springframework.org/schema/geode http://www.springframework.org/schema/geode/spring-geode.xsd"> <gfe:replicated-region id="regionId" cache-ref="myCacheRef"> <!-- 缓存未命中时,调用该加载器从DB等源加载数据 --> <gfe:cache-loader ref="myLoader"/> <gfe:cache-writer ref="myWriter"/> <!-- 过期策略统一配置容器 --> <gfe:expiration> <!-- Time-to-live (TTL):针对创建、put操作,超时后销毁条目 --> <gfe:entry-ttl timeout="300" action="DESTROY"/> <!-- Idle timeout (TTI):针对get、netSearch操作,超时后销毁条目 --> <gfe:entry-tti timeout="300" action="DESTROY"/> </gfe:expiration> </gfe:replicated-region> </beans>
关键说明
<gfe:expiration>是Spring Data Geode专门用于集中管理过期策略的容器节点,所有entry-ttl、entry-tti必须置于其下cache-loader、cache-writer可直接作为replicated-region的子元素,无需调整- 该配置完全兼容你使用的Apache Geode 1.14.4和spring-data-geode 2.7.2版本
内容的提问来源于stack exchange,提问作者Boss Man
相关产品推荐
相关产品推荐

