import net.spy.memcached.MemcachedClient; import java.net.InetSocketAddress; public class Consumer { static final int SLOT_COUNT = 10; public static void main(String args[]) throws Exception { MemcachedClient c = new MemcachedClient( new InetSocketAddress("localhost", 11211) ); int current = 0; while (true) { String key = "slot:" + current; String data = (String) c.get(key); if ( data != null) { System.out.println("Consuming slot " + current); System.out.println("Got >" +data + "<"); c.delete(key); } current = (current+1) % SLOT_COUNT; Thread.sleep( 900 ); } } }