如何使用memcached,当java编程的时候?
1.使用java版的客户端
参考官方文档 http://code.google.com/p/memcached/wiki/Clients#Java
包括如下多种客户端可以选择
1.1spymemcached
http://www.couchbase.org/code/couchbase/java
“ An improved Java API maintained by Matt Ingenthron and others at Couchbase. Aggressively optimised, ability to run async, supports binary protocol, support Membase and Couchbase features, etc. See site for details. ”针对异步进行优化,支持二进制协议,支持membase和couchbase特性。
由Matt Ingenthron 等维护的Java API。
1.2Java memcached client
http://www.whalin.com/memcached“A Java API is maintained by Greg Whalin from Meetup.com. ”
由Greg Whalin维护的Java API。
最新版本2.6.0下载地址: http://code.google.com/p/spymemcached/downloads/detail?name=memcached-2.6.jar&can=2&q=
1.3其他客户端
javamemcachedclient http://code.google.com/p/javamemcachedclient“ManyBrain Java Memcached client built for speed and high-scalability. Takes significant advantage of multi-core systems. Peak performance on loopback network at about number_of_threads = number_of_cores+2 (highly approximate). Throughput loss is gradual tested up to 500 threads. For real networks (with notably more latency than loopback) a few thousand threads should perform well (of course use, -Xss96k or so)
Very high performance for string and small payloads because of streamlined code. Large payloads (i.e., big hashmaps) still benefit, but less so as the Java serialization mechanism is a serious bottleneck.
This API is BETA and is not feature complete (yet). Notably, CAS is not supported. ”
好像很厉害的速度、高扩展特性。
memcache-client-forjava http://code.google.com/p/memcache-client-forjava
“当前最新版本为2.5.2。svn代码已经上传,有需要的同学可以直接下载使用maven来构建项目。
该项目是Memcache Java 客户端的实现
使用前先请下载帮助文档:在downloads中Memcached Client HandBook(特别注意对于第三方开源库版本依赖)
具体的代码,文档,测试内容都在Downloads 中可以获得
《MemCached Cache Java 客户端优化历程.doc》将描述详细的封装和优化过程
有任何问题可以联系wenchu.cenwc@alibaba-inc.com ”
xmemcached http://code.google.com/p/xmemcached
“XMemcached is a high performance, easy to use multithreaded memcached client injava.
It's nio based and was carefully turned to get top performance.
Xmemcached 1.4.1 has been released! Please check ReleaseNotes.”
高性能的多线程memcached客户端。
1.4Integrations
simple-spring-memcached http://code.google.com/p/simple-spring-memcached“Distributed caching can be a big, hairy, intricate, and complex proposition when using it extensively.
Simple Spring Memcached (SSM) attempts to simplify implementation for several basic use cases.”
memcached-session-manager http://code.google.com/p/memcached-session-manager
“A tomcat high-availability solution that additionally stores sessions in amemcached compatible key-value store for session failover, while reading them from local memory for optimal performance (for sticky sessions). For non-sticky sessions the memcached compatible backend is used as session store (keeping a copy of the session in a secondary memcached node). "memcached compatible" here refers to the memcached protocol, therefore the backend can be any (if you like persistent) solution "speaking" memcached (e.g.memcachedb,membase etc.). ”
2.使用通讯协议
参考官方问文档 http://code.google.com/p/memcached/wiki/NewProtocols
包括 text protocol 和 binary protocol
2013年7月2日18:49:34待续