-
Notifications
You must be signed in to change notification settings - Fork 280
Getting started
dennis zhuang edited this page Jul 28, 2016
·
1 revision
Xmemcached use slf4j for logging.
If you are using maven to build your project,you would just add a dependence with xmemcached:
<dependency>
<groupId>com.googlecode.xmemcached</groupId>
<artifactId>xmemcached</artifactId>
<version>${version}</version>
</dependency>
MemcachedClient client=new XMemcachedClient("host",11211);
//store a value for one hour(synchronously).
client.set("key",3600,someObject);
//Retrieve a value.(synchronously).
Object someObject=client.get("key");
//Retrieve a value.(synchronously),operation timeout two seconds.
someObject=client.get("key",2000);
//Touch cache item ,update it's expire time to 10 seconds.
boolean success=client.touch("key",10);
//delete value
client.delete("key");