It is quite simple to use the memcached client. In this section we will store and retrieve data from the memcached server and get a feel for the API.
The first thing we need to do before retrieving data is to actually create a connection to the memcached server. A static pool of servers is used by the client. You can of course specify more than one memcached server for the pool. Once we have a connection object, it can be used for all of the interaction with the server, and for setting and retrieving keys and their associated values. Here is a simple class that shows how we would do this in Java:
package simpledbbook; import com.danga.MemCached.MemCachedClient; import com.danga.MemCached.SockIOPool; import java.util.Date; public class MemcacheClientSdbBook { // A static pool of memcache servers for the client static { String[] serverList = {"localhost:11211"}; SockIOPool pool = SockIOPool.getInstance...