zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

xmemcached发布1.3.3版本——支持touch和GAT

2023-03-14 22:29:17 时间
  开源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>
文章转自庄周梦蝶  ,原文发布时间 2011-06-12