Check-and-Set an item; store data only if no one else has updated the item since its last fetch, determined with the cas token from the gets command. LSMCD assigns a unique 64-bit cas token to all items stored in it.

syntax:

cas <key> <flags> <TTL> <length> <cas unique key> [noreply]

parameters:

  • key - The name of the unique key by which data is accessed.
  • flags - A 32-bit unsigned integer that the server stores with the data provided by the user, and returns along with the data when the item is retrieved.
  • TTL - The length of time (in seconds) the key/value pair will be stored in cache. A 0 value means the data will “never expire” and should not be removed from the cache unless required. If the TTL is more than 30 days then LSMCD interprets it as UNIX timestamp for expiration.
  • length - The length of the data in bytes that needs to be stored in LSMCD.
  • cas unique key - A unique token number obtained from gets comamand.
  • noreply - This optional parameter tells the server not to send any reply.

example:

cas mykey 0 120 10 2
abcdeabcde

STORED

output notes:

  • 0 → no flags
  • 120 → store data for 2 minutes (120 seconds)
  • 10 → data is 10 bytes long
  • 2 → unique token number obtained from gets command

possible errors:

  • ERROR - Indicates an error while saving data or the wrong syntax.
  • EXISTS - Indicates that someone has modified the CAS data since its last fetch.
  • NOT_FOUND - Indicates that the provided key does not exist in the LSMCD server.
  • Admin
  • Last modified: 2016/04/07 18:54
  • by Rob Holda