Table of Contents

Interacting with LSMCD

In order to connect to and interact with LSMCD, you can use telnet to connect to a one of the IP addresses and port numbers set in Cached.Addr. For example, with the default settings, you would connect using the following command:

telnet 127.0.0.1 11211

LSMCD Commands

The following is a list of LSMCD commands useable in telnet, each with a description, an example use (including user input and system output), syntax, and an explanation of potentially confusing values. Note: for syntax, < and > indicate a required value while [ and ] indicate an optional one.

get

Read a value.

syntax:

get <key>

example:

get mykey

VALUE mykey 0 10
myvalueabc
END

notes:

bget

Binary get.

syntax:

bget <key>

example:

bget mykey

output:

VALUE mykey 0 10
	myvalueabc
	END

output notes:

gets

Read a value and its cas token (to be used with the cas command).

syntax:

gets <key>

example:

gets mykey

output:

VALUE mykey 0 10 9
	myvalueabc
	END

output notes:

add

Add a new key/value pair, but only if the server doesn’t already hold data for this key.

syntax:

add <key> <flags> <TTL> <length> [noreply] \r\n <value> \r\n

example:

add newkey 0 120 10

output:

myvalueabc
	STORED

output notes:

set

Store a key/value pair, if the key exists already, overwrite it.

syntax:

set <key> <flags> <TTL> <length> [noreply] \r\n <value> \r\n

example:

set mykey 0 120 10

output:

myvalueabc
	STORED

output notes:

replace

Store a key/value pair, but only if it already exists.

syntax:

replace <key> <flags> <TTL> <length> [noreply] \r\n <value> \r\n

example:

replace mykey 0 120 10

output:

myvalueabc
	STORED

output notes:

append

Add data to an existing key after existing data.

syntax:

append <key> <flags> <TTL> <length> [noreply]  \r\n <value> \r\n

example:

append mykey 0 120 10

output:

defghijklm
	STORED

output notes:

prepend

Add data to an existing key before existing data.

syntax:

prepend <key> <flags> <TTL> <length> [noreply] \r\n <value> \r\n

example:

prepend mykey 0 120 10

output:

abcdeabcde
	STORED

output notes:

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:

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

example:

cas mykey 0 120 10 2

output:

abcdeabcde
	STORED

output notes:

incr

Increment numerical key’s value by the given number if the key/value pair exists.

syntax:

incr <key> <value> [noreply]

example:

incr mykey 4

output:

5

output notes:

decr

Decrement numerical key’s value by the given number if the key/value pair exists.

syntax:

decr <key> <value> [noreply]

example:

decr mykey 3

output:

2

output notes:

delete

Delete an existing key/value pair.

syntax:

delete <key> [<time>] [noreply]

example:

delete mykey

output:

DELETED

touch

Update the expiration time for a key/value pair without fetching it.

syntax:

touch <key> <TTL> [noreply]

example:

touch mykey 1200

output:

TOUCHED

output notes:

stats

Print or reset general statistics

syntax:

stats [reset]

example:

stats

output:

STAT pid 16825
STAT version 1.0.0
STAT pointer_size 64
STAT rusage_user 0.300000
STAT rusage_system 0.520000
STAT cmd_get 10
STAT cmd_set 11
STAT cmd_flush 2
STAT cmd_touch 2
STAT get_hits 8
STAT get_misses 2
STAT delete_misses 0
STAT delete_hits 1
STAT incr_misses 0
STAT incr_hits 1
STAT decr_misses 1
STAT decr_hits 1
STAT cas_misses 0
STAT cas_hits 1
STAT cas_badval 0
STAT touch_hits 2
STAT touch_misses 0
STAT auth_cmds 0
STAT auth_errors 0
END

example:

stats reset

output:

RESET

flush_all

Delete all key/value pairs immediately.

syntax:

flush_all [<time>] [noreply]

example:

flush_all

output:

OK

version

Print server version.

syntax:

version

example:

version

output:

VERSION 1.0.0

quit

Terminate telnet session.

syntax:

quit

example:

quit

output:

Connection closed by foreign host.

verbosity

Increase log version.

syntax:

verbosity <level> [noreply]

example:

verbosity 1

output:

OK