2 zhangw 2005 zhangw_2005 于 2017.09.08 21:41 提问

hibernate memcached默认缓存只有300秒,5分钟,怎么设置?

spring配置文件:
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean" lazy-init="false">



com.test.springmvcsh.*




org.hibernate.dialect.MySQLDialect
true

             <!-- *****************memcache start *********************************** -->
             <prop key="hibernate.cache.use_second_level_cache">true</prop>
             <prop key="hibernate.cache.region.factory_class">com.googlecode.hibernate.memcached.MemcachedRegionFactory</prop>  
             <prop key="hibernate.memcached.servers">127.0.0.1:11211</prop>  
             <prop key="hibernate.cache.region_prefix">memcached2</prop>
             <prop key="hibernate.memcached.operationTimeout">36000</prop>
             <prop key="hibernate.memcached.cacheTimeSeconds">36000</prop>
             <prop key="hibernate.cache.use_structured_entries">true</prop>
             <prop key="hibernate.cache.use_query_cache">true</prop>
        </props>
    </property>
</bean>

    经测试,memcached缓存数据只有5分钟,超过五分钟就又从数据库取数据,怎么设置memcached的缓存时间?

36000
这里的设置没生效。

Csdn user default icon
上传中...
上传图片
插入图片