Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision Next revision Both sides next revision | ||
litespeed_wiki:lsmcd:commands [2016/04/06 20:00] Rob Holda created |
litespeed_wiki:lsmcd:commands [2016/04/07 14:08] Rob Holda [incr] |
||
---|---|---|---|
Line 6: | Line 6: | ||
</code> | </code> | ||
- | The following is a list of LSMCD commands useable in telnet, each with a description, the command's syntax, an example of use (including user input and system output separated by an empty line), and an explanation of potentially confusing values. Note: in the syntax sections, values enclosed in <> indicate a required value while values enclosed in [] indicate an optional one. | + | The following is a list of LSMCD commands useable in telnet, each with a brief description. For more information, see each command's page. |
- | ===== get ===== | + | [[litespeed_wiki:lsmcd:commands:get|get]] - Read the value tied to the user-provided key. |
- | Read a value. | + | |
- | **syntax:** | + | [[litespeed_wiki:lsmcd:commands:bget|bget]] - Read the binary value tied to the user-provided key. |
- | <code> | + | |
- | get <key> | + | |
- | </code> | + | |
- | **example:** | + | |
- | <code> | + | |
- | get mykey | + | |
- | VALUE mykey 0 10 | + | [[litespeed_wiki:lsmcd:commands:gets|gets]] - Read the value tied to the user-provided key and its cas token (to be used with the [[litespeed_wiki:lsmcd:commands:cas|cas]] command). |
- | myvalueabc | + | |
- | END | + | |
- | </code> | + | |
- | **notes:** | + | |
- | * **0** → no flags | + | |
- | * **10** → Size in bytes | + | |
- | * **myvalueabc** → value of "mykey" | + | |
- | ===== bget ===== | + | [[litespeed_wiki:lsmcd:commands:add|add]] - Add a key/value pair only if a pair does not already exist for the user-provided key. |
- | Read a binary value. | + | [[litespeed_wiki:lsmcd:commands:set|set]] - Store a key/value pair. If a pair already exists for the user-provided key, overwrites it. |
- | **syntax:** | + | [[litespeed_wiki:lsmcd:commands:replace|replace]] - Store a key/value pair, but only if it already exists. |
- | <code> | + | |
- | bget <key> | + | |
- | </code> | + | |
- | **example:** | + | |
- | <code> | + | |
- | bget mykey | + | |
- | VALUE mykey 0 10 | + | [[litespeed_wiki:lsmcd:commands:append|append]] - Add data to an existing key after existing data. |
- | abcdefghij | + | |
- | END</code> | + | |
- | **output notes:** | + | |
- | * **0** → no flags | + | |
- | * **10** → Size in bytes | + | |
- | * **myvalueabc** → value of "mykey" | + | |
- | ===== gets ===== | + | [[litespeed_wiki:lsmcd:commands:prepend|prepend]] - Add data to an existing key before existing data. |
- | Read a value and its cas token (to be used with the **cas** command). | + | |
- | **syntax:** | + | [[litespeed_wiki:lsmcd:commands:cas|cas]] - Check-and-Set an item; store data only if no one else has updated since the last fetch, determined with the cas token from the [[litespeed_wiki:lsmcd:commands:gets|gets]] command. |
- | <code> | + | |
- | gets <key> | + | |
- | </code> | + | |
- | **example:** | + | |
- | <code> | + | |
- | gets mykey | + | |
- | VALUE mykey 0 10 9 | ||
- | myvalueabc | ||
- | END | ||
- | </code> | ||
- | **output notes:** | ||
- | * **0** → no flags | ||
- | * **10** → Size in bytes | ||
- | * **9** → unique cas token number | ||
- | |||
- | ===== add ===== | ||
- | Add a new key/value pair, but only if the server doesn’t already hold data for this key. | ||
- | |||
- | **syntax:** | ||
- | <code> | ||
- | add <key> <flags> <TTL> <length> [noreply] \r\n <value> \r\n | ||
- | </code> | ||
- | **example:** | ||
- | <code> | ||
- | add newkey 0 120 10 | ||
- | myvalueabc | ||
- | |||
- | STORED | ||
- | </code> | ||
- | **output notes:** | ||
- | * **0** → no flags | ||
- | * **120** → TTL in seconds | ||
- | * **10** → Size in bytes | ||
- | * **myvalueabc** → value to set "newkey" to | ||
- | |||
- | ===== set ===== | ||
- | Store a key/value pair, if the key exists already, overwrite it. | ||
- | |||
- | **syntax:** | ||
- | <code> | ||
- | set <key> <flags> <TTL> <length> [noreply] \r\n <value> \r\n | ||
- | </code> | ||
- | |||
- | **parameters:** | ||
- | * **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** | ||
- | * **length** | ||
- | * **noreply** | ||
- | * **value** | ||
- | |||
- | **example:** | ||
- | <code> | ||
- | set mykey 0 120 10 | ||
- | myvalueabc | ||
- | |||
- | STORED | ||
- | </code> | ||
- | ===== replace ===== | ||
- | |||
- | Store a key/value pair, but only if it already exists. | ||
- | |||
- | **syntax:** | ||
- | <code> | ||
- | replace <key> <flags> <TTL> <length> [noreply] \r\n <value> \r\n | ||
- | </code> | ||
- | **example:** | ||
- | <code> | ||
- | replace mykey 0 120 10 | ||
- | myvalueabc | ||
- | |||
- | STORED | ||
- | </code> | ||
- | **output notes:** | ||
- | * **0** → no flags | ||
- | * **120** → TTL in seconds | ||
- | * **10** → Size in bytes | ||
- | * **myvalueabc** → value to set "mykey" to | ||
- | |||
- | ===== append ===== | ||
- | Add data to an existing key after existing data. | ||
- | |||
- | **syntax:** | ||
- | <code> | ||
- | append <key> <flags> <TTL> <length> [noreply] \r\n <value> \r\n | ||
- | </code> | ||
- | **example:** | ||
- | <code> | ||
- | append mykey 0 120 10 | ||
- | defghijklm | ||
- | |||
- | STORED | ||
- | </code> | ||
- | **output notes:** | ||
- | * **0** → no flags | ||
- | * **120** → TTL in seconds | ||
- | * **10** → Size to append in bytes | ||
- | * In this example, if "mykey" had a value of "myvalueabc", after running **append**, its value would be "myvalueabcdefghijklm". | ||
- | |||
- | ===== prepend ===== | ||
- | Add data to an existing key before existing data. | ||
- | |||
- | **syntax:** | ||
- | <code> | ||
- | prepend <key> <flags> <TTL> <length> [noreply] \r\n <value> \r\n | ||
- | </code> | ||
- | **example:** | ||
- | <code> | ||
- | prepend mykey 0 120 10 | ||
- | abcdeabcde | ||
- | |||
- | STORED | ||
- | </code> | ||
- | **output notes:** | ||
- | * **0** → no flags | ||
- | * **120** → TTL in seconds | ||
- | * **10** → Size to prepend in bytes | ||
- | * In this example, if "mykey" had a value of "myvalueabc", after running **prepend**, its value would be "abcdeabcdemyvalueabc". | ||
- | |||
- | ===== cas ===== | ||
- | Check-and-Set an item; store data only if no one else has updated since the last fetch, determined with the cas token from the **gets** command. | ||
- | |||
- | **syntax:** | ||
- | <code> | ||
- | cas <key> <flags> <TTL> <length> <cas unique key> [noreply] | ||
- | </code> | ||
- | **example:** | ||
- | <code> | ||
- | cas mykey 0 120 10 2 | ||
- | abcdeabcde | ||
- | |||
- | STORED | ||
- | </code> | ||
- | **output notes:** | ||
- | * **0** → no flags | ||
- | * **120** → TTL in seconds | ||
- | * **10** → Size in bytes | ||
- | * **2** → unique token number obtained from **gets** command | ||
===== incr ===== | ===== incr ===== | ||
Increment numerical key’s value by the given number if the key/value pair exists. | Increment numerical key’s value by the given number if the key/value pair exists. | ||
- | |||
- | **syntax:** | ||
- | <code> | ||
- | incr <key> <value> [noreply] | ||
- | </code> | ||
- | **example:** | ||
- | <code> | ||
- | incr mykey 4 | ||
- | |||
- | 5 | ||
- | </code> | ||
- | **output notes:** | ||
- | * **4** → value to increment by | ||
- | * In this example, if "mykey" had a value of "1", after running **incr**, its value would be "5". | ||
- | |||
===== decr ===== | ===== decr ===== | ||
Decrement numerical key’s value by the given number if the key/value pair exists. | Decrement numerical key’s value by the given number if the key/value pair exists. |