在 hibernate.cfg.xml 中定义所有 memcached 属性后,如何在我的代码中创建 memcachedclient?
Hibernate.cfg.xml:-
<property name="hibernate.cache.provider_class">com.googlecode.hibernate.memcached.MemcachedCacheProvider</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.use_query_cache">false</property>
<property name="hibernate.cache.use_minimal_puts">true</property>
<property name="hibernate.cache.region_prefix">MemcachedCache</property>
<property name="hibernate.memcached.memcacheClientFactory">com.googlecode.hibernate.memcached.dangamemcached.DangaMemcacheClientFactory</property>
<property name="hibernate.Memcached.servers"> 10.2.200.114:11211 </property>
<property name="hibernate.Memcached.cacheTimeSeconds">300</property>
<property name="hibernate.Memcached.connectionFactory">KetamaConnectionFactory</property>
<property name="hibernate.memcached.keyStrategy">HashCodeKeyStrategy</property>
<property name="hibernate.memcached.readBufferSize">DefaultConnectionFactory.DEFAULT_READ_BUFFER_SIZE</property>
<property name="hibernate.memcached.operationQueueLength">DefaultConnectionFactory.DEFAULT_OP_QUEUE_LEN</property>
<property name="hibernate.memcached.operationTimeout">DefaultConnectionFactory.DEFAULT_OPERATION_TIMEOUT</property>
<property name="hibernate.memcached.hashAlgorithm">HashAlgorithm.KETAMA_HASH</property>
<property name="hibernate.memcached.clearSupported">false</property>
就像一样
MemcachedClient client = new MemcachedClient(new KetamaConnectionFactory(), AddrUtil.getAddresses("10.2.200.114:11211"));
如果没有,如果我必须使用 hibernate.cfg.xml 中定义的属性,那么我应该如何继续?