`
neptune
  • 浏览: 357469 次
  • 性别: Icon_minigender_1
  • 来自: 沈阳
社区版块
存档分类
最新评论

memcached 1.6 终于可以不用get-set来重新设置数据的超时时间

阅读更多

http://www.blogjava.net/killme2008/archive/2011/06/12/352120.html

开源memcached的java客户端xmemcached发布1.3.3,主要改进如下:

1、memcached 1.6添加了不少新特性,具体可以参考《what's new in memcached》(1) (2)这两个帖子。xmemcached将及时跟进这些新特性。1.3.3这个版本实现了二进制协议中新的两个命令touch和GAT(get and touch)。这两个功能可以说是千呼万唤始出来,终于可以不用get-set来重新设置数据的超时时间,利用touch或者GAT可以简单地更新数据的超时时间。1.3.3新增加四个方法:

    public boolean touch(final String key, int exp, long opTimeout)
            
throws TimeoutException, InterruptedException, MemcachedException;
    
public boolean touch(final String key, int exp) throws TimeoutException,
            InterruptedException, MemcachedException;
        
public <T> T getAndTouch(final String key, int newExp, long opTimeout)
            
throws TimeoutException, InterruptedException, MemcachedException;
    
public <T> T getAndTouch(final String key, int newExp)
            
throws TimeoutException, InterruptedException, MemcachedException;

其中touch用于设置数据新的超时时间,getAndTouch则是在获取数据的同时更新超时时间。例如用memcached存储session,可以在每次get的时候更新下数据的超时时间来保活。请注意,这四个方法仅在使用memcached 1.6并且使用二进制协议的时候有效

2、setLoggingLevelVerbosity方法可以作用于二进制协议。


3、重构错误处理模块,使得异常信息更友好。


4、将KeyIterator和getKeyIterator声明为deprecated,因为memached 1.6将移除stats cachedump协议,并且stats cachedump返回数据有大小限制,遍历功能不具实用性。

5、修复Bug,包括issue 126 ,issue 127,issue 128,issue 129

下载地址:http://code.google.com/p/xmemcached/downloads/list
源码:  https://github.com/killme2008/xmemcached
maven引用:
 <dependency>
      
<groupId>com.googlecode.xmemcached</groupId>
      
<artifactId>xmemcached</artifactId>
      
<version>1.3.3</version>
 
</dependency>

posted on 2011-06-12 13:32 dennis 阅读(2406) 评论(2)  编辑  收藏 所属分类: java 、my open-source

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics