Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
litespeed_wiki:lsmcd:commands:cas [2016/04/06 21:36] Rob Holda |
litespeed_wiki:lsmcd:commands:cas [2016/04/07 18:54] (current) Rob Holda |
||
---|---|---|---|
Line 1: | Line 1: | ||
===== cas ===== | ===== cas ===== | ||
- | 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 [[litespeed_wiki:lsmcd:commands:gets|gets]] command. LSMCD assigns a unique 64-bit CAS token to all items stored in it. | + | 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 [[litespeed_wiki:lsmcd:commands:gets|gets]] command. LSMCD assigns a unique 64-bit cas token to all items stored in it. |
**syntax:** | **syntax:** | ||
Line 8: | Line 8: | ||
**parameters:** | **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. | * **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. | * **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. | ||
Line 26: | Line 27: | ||
* **10** → data is 10 bytes long | * **10** → data is 10 bytes long | ||
* **2** → unique token number obtained from [[litespeed_wiki:lsmcd:commands:gets|gets]] command | * **2** → unique token number obtained from [[litespeed_wiki:lsmcd:commands:gets|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. |