Windows下的Memcache安装:
1. 下载memcache的windows稳定版,解压放某个盘下面,比如在c:\memcached
2. 在终端(也即cmd命令界面)下输入 'c:\memcached\memcached.exe -d install' 安装
3. 再输入: 'c:\memcached\memcached.exe -d start' 启动。
NOTE: 以后memcached将作为windows的一个服务每次开机时自动启动。这样服务器端已经安装完毕了。
memcache-client是官方公布的jar包,源代码内容较少,与Spring集成也比较简单,步骤如下:
1.添加memcache-client.jar包至工程中;
2.在web.xml文件中添加配置
<context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/conf/spring/*-beans.xml </param-value> </context-param>
3.在属性文件中添加如下配置:
#memcache配置 memcache.server=127.0.0.1\:11211 memcache.initConn=20 memcache.minConn=10 memcache.maxConn=50 memcache.maintSleep=3000 memcache.nagle=false memcache.socketTO=3000
4.在/WEB-INF/conf/spring/目录下添加配置文件memcache-beans.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:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-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"> <bean id="memcachedPool" class="com.danga.MemCached.SockIOPool" factory-method="getInstance" init-method="initialize" destroy-method="shutDown"> <property name="servers"> <list> <value>${memcache.server}</value> </list> </property> <property name="initConn"> <value>${memcache.initConn}</value> </property> <property name="minConn"> <value>${memcache.minConn}</value> </property> <property name="maxConn"> <value>${memcache.maxConn}</value> </property> <property name="maintSleep"> <value>${memcache.maintSleep}</value> </property> <property name="nagle"> <value>${memcache.nagle}</value> </property> <property name="socketTO"> <value>${memcache.socketTO}</value> </property> </bean> <bean id="memcachedClient" class="com.danga.MemCached.MemCachedClient"> </bean> </beans>
5.在Action中测试代码如下:
@RequestMapping(value = "/add") public void add(HttpServletRequest request, ModelMap model){ List<FmSupplier> list = supplierManager.getEnableSuppliers(); memcachedClient.add("list", list); List<FmSupplier> listTemp = (List<FmSupplier>) memcachedClient.get("list"); } @RequestMapping(value = "/show") public void store(HttpServletRequest request, ModelMap model){ List<FmSupplier> listTemp = (List<FmSupplier>) memcachedClient.get("list"); for(FmSupplier temp :listTemp) System.out.println(temp.getLinkman()); }
以下是Memcache Win32以及memcache-client.jar包
相关推荐
修复两处关键 Bug 的 memcacheclient-2.0 完整源码。
Memcache-client for php 一个PHP 的 Memcached缓存 客户端
在windows 64位机器上的memcached应用程序 以及 php_memcache.dll扩展 注意:是64位的版本!! 测试在Win7-64bit,php5.3.13-vc9-ts 环境下可以使用~~
spring与memcache的开发配置!很详细
memcache3.08-php-源码,可配合任意php编译。
使用github上的php7分支自行编译,未修改源码。 匹配API20151012,NTS,VC14
php_memcache-3.0.8-5.6-nts-vc11-x86 example.php memcache.php
php_memcache-3.0.8-5.5-ts-vc11-x64 用于 for php5.5 64位版本
php_memcache-3.0.8-5.5-nts-vc11-x64.zip php_memcache-3.0.8-5.5-nts-vc11-x86.zip php_memcache-3.0.8-5.5-ts-vc11-x64.zip php_memcache-3.0.8-5.5-ts-vc11-x86.zip php_memcache-3.0.8-5.6-nts-vc11-x64.zip ...
阿里云-云数据库Memcache-最佳实践-D.docx
阿里云-云数据库Memcache-快速入门-D.docx
阿里云-云数据库Memcache-API手册-D.docx
从最老php5.2版本,到最新的php7.2,各个版本,x86,x64版本都有,希望想要使用的朋友,直接下载找到对应版本就直接使用,一次性打包全部,一次性解决各个版本的memcache扩展 亲测可用,用的时候,将...
memcache的客户端,用maven构建,里有用hibernate-memcached与hibernate,spring3.0进行配置,也有与spring3.0单独配置。
memcache 3.08 用于php扩展
php_memcache-3.0.7-5.3-ts-vc9-x86.zip php 5.3 32位 线程安全
Installing Memcache on Wamp 2.1e and Windows 7 php_memcache-cvs-20090703-5.3-VC6-x86+使用方法+php5.3.X
Windows下的php_memcache扩展,亲测可用。对应:PHP版本5.3,线性安全,扩展编译器vc6,系统x86。
Nginx+双tomcat+memcache实现软负载 可参见我的文单里的相关配置
32位 非线程安全 php memcache.dll vc9