编译前,请先确认gcc、make、patch等编译工具是否已安装,并可正常使用。
资源包:
1. libevent
Libevent是一个异步事件处理软件函式库,以BSD许可证释出。Memcached依赖Libevent,因此必须先编译安装Libevent。
下载地址:http://http://www.monkey.org/~provos/libevent-2.0.13-stable.tar.gz
wget http://www.monkey.org/~provos/libevent-2.0.13-stable.tar.gz
tar xzvf libevent-2.0.13-stable.tar.gz
./configure
make
sudo make install
检测libevent 安装是否成功,输入:# ls -al /usr/lib | grep libevent
2.mecached
不错的文章
3.java客户端
http://www.couchbase.org/code/couchbase/java
memcached-2.7.jar
jettison-1.1.jar
http://www.docjar.com/jar_detail/jettison-1.1.jar.html
commons-codec-1.4.jar
http://commons.apache.org/codec/download_codec.cgi
netty-3.1.5.GA.jar
http://linkedin.jira.com/source/browse/SENSEI/branches/BR_DEV_JOHN/lib/netty-3.1.5.GA.jar?r=8
/*建立MemcachedClient 实例,并指定memcached服务的IP地址和端口号*/
MemcachedClient mc = new MemcachedClient(new InetSocketAddress("192.168.1.5", 11111));
Map<String, Object> m = new HashMap();
m.put("1", "Hello Memcache");
Future<Boolean> b = mc.set("key", 900, m);
if(b.get().booleanValue()==true){
Map<String,String> result = (Map)mc.get("key");
System.out.println(result.get("1"));
mc.shutdown();
}
来源:oschina
链接:https://my.oschina.net/u/94965/blog/37238