memcached安装及使用
来源:互联网 发布:csgo国际服除了淘宝 编辑:程序博客网 时间:2024/05/16 13:55
一、下载memcached windows 版本 ,使用cmd进入命令窗口,进入到memcached.exe的目录下,命令memcached.exe –d install 安装
二、启动memcached.exe -d start
三、telnet 本机IP地址 11211(默认端口号)
四、使用
配置文件:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:cxf="http://cxf.apache.org/core" xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
<bean id="memcachedPool" class="com.danga.MemCached.SockIOPool"
factory-method="getInstance" init-method="initialize"
destroy-method="shutDown">
<constructor-arg>
<value>neeaMemcachedPool</value>
</constructor-arg>
<property name="servers">
<list>
<value>192.168.201.42:11211</value>
</list>
</property>
<property name="initConn">
<value>20</value>
</property>
<property name="minConn">
<value>10</value>
</property>
<property name="maxConn">
<value>50</value>
</property>
<property name="maintSleep">
<value>30000</value>
</property>
<property name="nagle">
<value>false</value>
</property>
<property name="socketTO">
<value>3000</value>
</property>
</bean>
<bean id="memcachedClient"
class="com.danga.MemCached.MemCachedClient">
<constructor-arg>
<value>neeaMemcachedPool</value>
</constructor-arg>
<property name="compressEnable">
<value>true</value>
</property>
<property name="compressThreshold">
<value>4096</value>
</property>
</bean>
</beans>
测试类:
public class CacheUtil {
private Log log = LogFactory.getLog(CacheUtil.class);
private MemCachedClient cachedClient = null;
@Before
public void init() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"application_memcached.xml");
cachedClient = (MemCachedClient) context.getBean("memcachedClient");
}
@Test
public void testCache() {
cachedClient.add("hello", "world");
String s = (String) cachedClient.get("hello");
log.info(s);
Assert.assertEquals("world", s);
}
}
- memcached安装及使用
- memcached安装及使用
- Memcached安装及使用
- memcached安装及使用
- memcached的安装及使用
- memcached的安装及使用
- memcached安装及.NET中的Memcached.ClientLibrary使用详解
- memcached安装及.NET中的Memcached.ClientLibrary使用详解
- Memcached安装及配置使用实例
- memcached php-memcache 的安装及使用
- memcached、php-memcache安装及使用
- window下memcached安装步骤及使用
- memcached的安装、配置及使用
- 安装Memcached及Memcached配置
- Memcached安装及配置
- memcached简介及安装
- NoSql1 在Linux(CentOS)上安装memcached及使用
- memcached windows下载安装及使用(一)
- 移动客户端谈入手百度推送经验
- Linux网卡中断使单个CPU过载
- VM-Linux配置问题及常用linux命令
- end call
- 单点登录之CAS简单介绍
- memcached安装及使用
- 在Jquery中怎么判断input的类型
- XP中“登录失败:未授予用户在此计算机上的请求登录类型”的解决
- 把文件存放在SDCard
- swift UITableView 表视图
- 安卓随手笔记十:(listview分页功能)
- Cocos2d-x学习(一):HelloWorld
- redis主从配置及主从切换
- Amdroid-APK-签名-证书提取