Memcached – Get CAS Data
Memcached gets command is used to get the value with CAS data. It is an alternative get command which is used for CAS data. This command returns a CAS identifier (a unique 64bit number) with the item. If the key does not exist in Memcached, it returns nothing.
Syntax
Here,
key: It is the key data stored and retrieved from Memcached.
Example in Ubuntu
Let’s see an example for “gets” command. Here we will use ‘city‘ as the key and store ‘bangalore’ in it with the expiration of time 900 seconds.
Example in Windows
Let’s see an example for “gets” command. Here we will use ‘city‘ as the key and store ‘bangalore’ in it with the expiration of time 900 seconds.
Memcached Server
Memcached Client
CAS using Java Application
Consider that Memcached server is running on host 127.0.0.1and port 11211. Here, we will use gets() method to get CAS data from a Memcached server.
Example
Output:
Connection to server successfully set status: true Get from Cache:{CasValue 2/bangalore}