Posted on 2011-06-12 13:32
dennis 閱讀(4226)
評論(3) 編輯 收藏 所屬分類:
java 、
my open-source
開源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/xmemcachedmaven引用:
<dependency>
<groupId>com.googlecode.xmemcached</groupId>
<artifactId>xmemcached</artifactId>
<version>1.3.3</version>
</dependency>