2012-12-19 4 views
1
<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" 
    xmlns:gfe="http://www.springframework.org/schema/gemfire" 
    xsi:schemaLocation="http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd 
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
     http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> 

    <util:properties id="gemfire-props"> 
     <prop key="log-level">warning</prop> 
    </util:properties> 

    <gfe:cache properties-ref="gemfire-props" /> 

    <gfe:local-region id="LocalRegion1"> 
     <gfe:cache-listener> 
      <bean 
       class="com.mycompany.util.LoggingCacheListener" /> 
     </gfe:cache-listener> 
    </gfe:local-region> 

</beans> 

LocalRegion1 또는 위에서 정의한 캐시의 실시간 등록 정보를 어떻게 추가 할 수 있습니까? 24 시간마다 캐시를 ​​완전히 새로 고치고 서버에서 새 데이터를 가져오고 싶습니다. 로컬 캐시를 사용하여 서버와 저장소에서 데이터를 가져옵니다.내 캐시에 등록 할 시간을 추가하십시오.

아래에 언급 한 바와 같이 당신은, 지역-TTL 노드를 추가하여, 지역에 활동 시간을 설정할 수 있습니다

답변

1

:이 예에서

<gfe:local-region id="LocalRegion1"> 
    <gfe:region-ttl timeout="${local.region1.ttl}" action="DESTROY"/> 
    <gfe:cache-listener> 
     <bean 
      class="com.mycompany.util.LoggingCacheListener" /> 
    </gfe:cache-listener> 
</gfe:local-region>  

, 당신은 활동 시간에 설정할 수 있습니다 초 단위로 local.region1.ttl이라는 속성을 사용합니다. 물론 당신은 항상 해당 속성의 이름을 변경하거나 대신 (60 초) 리터럴을 사용

<gfe:region-ttl timeout="60" action="DESTROY"/> 

참고 타이머가 당신이/업데이트 지역에 항목을 추가 할 때마다 다시 설정됩니다.

관련 문제