Loading

Memcached 集群环境Java客户端

Memcached 集群环境Java客户端

学习了:

http://blog.csdn.net/zhouzhiwengang/article/details/53154112

http://guazi.iteye.com/blog/1071646

还有:

http://blog.csdn.net/xuke6677/article/details/38706501

 

程序文件下载:https://files.cnblogs.com/files/stono/cache.rar

简版集群调用:

package com.stono.memcached;

import com.danga.MemCached.MemCachedClient;
import com.danga.MemCached.SockIOPool;

public class TestCluster {
    public static void main(String[] args) {
        MemCachedClient client = new MemCachedClient();
        
        SockIOPool pool = SockIOPool.getInstance();
        String [] servers = {"127.0.0.1:11211","127.0.0.1:22122"};
        pool.setServers(servers);
        pool.initialize();
        client.add("ab", "ab12345");
    }
}

然后可以使用客户端进行查看,只在一台服务器上面有值。

 

posted @ 2017-12-23 10:33  stono  阅读(127)  评论(0编辑  收藏  举报