89
Memcached – Get Data
Memcached get command is used to retrieve the value stored at key. This command takes one or more keys and returns all found items. If the key does not exist in Memcached, then it will return nothing.
Syntax
Here,
key: It is the key data stored and retrieved from Memcached.
Example in Ubuntu
Let’s see an example for “get” command. Here, we will use ‘city’ as the key and store ‘bangalore’ in it with expiration of time 900 seconds.
Example in Windows:
Let’s see an example for “get” command. Here we will use ‘city’ as the key and store ‘bangalore’ in it with the expiration of time is 900 seconds.
Memcached Server:
Memcached Client
Get data using Java Application
Consider that Memcached server is running on host 127.0.0.1and port 11211. Here, we will use get() method to get data in Memcached server.
Example
Output:
Connection to server successfully set status: true Get from Cache:bangalorebangalore
Next TopicMemcached – Get CAS Data