成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

spring與memcached如何集成

這篇文章主要介紹了spring與memcached如何集成,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

創(chuàng)新互聯(lián)科技有限公司專業(yè)互聯(lián)網(wǎng)基礎(chǔ)服務(wù)商,為您提供成都天府聯(lián)通服務(wù)器托管,高防主機(jī),成都IDC機(jī)房托管,成都主機(jī)托管等互聯(lián)網(wǎng)服務(wù)。

applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"


       xmlns:hcj="http://www.springframework.org/schema/aop"


       xsi:schemaLocation="http://www.springframework.org/schema/beans

           http://www.springframework.org/schema/beans/spring-beans.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
        ">
 <!-- 通過(guò)單例模式factory-method去找到無(wú)參的構(gòu)造,構(gòu)造方法調(diào)用的還是SchoonerSockIOPool.getInstance方法,然后再進(jìn)行的初始化 -->
 <bean id="sockIOPool" class="com.danga.MemCached.SockIOPool" factory-method="getInstance" init-method="initialize">
  <property name="servers">
   <list>
    <value>ip和端口號(hào)</value>
   </list>
  </property>
 </bean>
</beans>

java class

package com.bw.memcached;

import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.danga.MemCached.MemCachedClient;
import com.danga.MemCached.SockIOPool;
//import com.schooner.MemCached.SchoonerSockIOPool;

public class MemcachedTest {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
		context.getBean("sockIOPool",SockIOPool.class);
		MemCachedClient client = new MemCachedClient();
//		SockIOPool sockIo = SockIOPool.getInstance(); //得到一個(gè)初始的池子用來(lái)存放連接
//		String[] as = {"ip:端口號(hào)"}; //聲明一個(gè)字符串?dāng)?shù)組,存放連接
//		sockIo.setServers(as); //將所有的連接加入池子
//		sockIo.setInitConn(10); //設(shè)置初始化連接數(shù)
//		sockIo.initialize(); //進(jìn)行初始化
//		System.out.println("=======初始化連接數(shù)======="+sockIo.getInitConn());
		client.add("鍵", "對(duì)象");
		System.out.println(client.get("鍵"));
//以上注釋的都是在沒(méi)有與spring集成的情況下
	}
}

感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“spring與memcached如何集成”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持創(chuàng)新互聯(lián),關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來(lái)學(xué)習(xí)!

網(wǎng)站欄目:spring與memcached如何集成
文章轉(zhuǎn)載:http://jinyejixie.com/article26/ggsscg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供響應(yīng)式網(wǎng)站、軟件開(kāi)發(fā)、App開(kāi)發(fā)、網(wǎng)站設(shè)計(jì)公司建站公司、Google

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設(shè)
定远县| 九江市| 应城市| 汨罗市| 新巴尔虎左旗| 田林县| 梅河口市| 策勒县| 汉阴县| 九寨沟县| 枣庄市| 河池市| 桑植县| 河池市| 平昌县| 南靖县| 上杭县| 和龙市| 闻喜县| 囊谦县| 巴塘县| 宁城县| 贺州市| 顺义区| 万源市| 金秀| 句容市| 同心县| 石林| 韶关市| 岐山县| 秦安县| 拉孜县| 辰溪县| 宜都市| 新安县| 罗甸县| 织金县| 丰顺县| 抚州市| 东宁县|