Written by - Yash Agrawal

memcached get data


This command is used to retrieve the data from the storage if nothing is present.

Code Example:

get key

Here key is the value to retrieve the particular data.

Java Example:

import net.spy.memcached.MemcachedClient;  
public class MemcachedJava {  
   public static void main(String[] args) {  
      // Connecting to Memcached server on localhost  
      MemcachedClient mcc = new MemcachedClient(new  
      InetSocketAddress("127.0.0.1", 11211));  
      System.out.println("Connection to server sucessfully");  
      System.out.println("set status:"+mcc.set("city", 900, "bangalore").done);  
       
     // Get value from cache  
      System.out.println("Get from Cache:"+mcc.get("city"));  
   }  
}