ASCII Protocol

The ASCII text protocol is the simplest way to interact with RedCouch. It uses human-readable commands over a plain TCP connection, making it easy to test and debug with standard tools like telnet or nc.

RedCouch supports all 19 standard memcached ASCII commands. For the complete compatibility table with syntax details, see Protocol Compatibility Reference.

Connecting

telnet 127.0.0.1 11210
# or
nc 127.0.0.1 11210

RedCouch auto-detects ASCII protocol when the first byte is a printable ASCII character (not 0x80, which routes to binary protocol).

Basic Key-Value Operations

# Store a value
set mykey 0 0 5
hello
STORED

# Retrieve it
get mykey
VALUE mykey 0 5
hello
END

# Store with flags and TTL (60 seconds)
set session:abc 42 60 11
session_data
STORED

# Retrieve with CAS token
gets mykey
VALUE mykey 0 5 1
hello
END

# Compare-and-swap (CAS) update
cas mykey 0 0 5 1
world
STORED

# Delete
delete mykey
DELETED

Counters

# Create a counter via set (store numeric string)
set counter 0 0 1
0
STORED

# Increment
incr counter 1
1

# Increment by 10
incr counter 10
11

# Decrement
decr counter 3
8

Note: In ASCII protocol, incr/decr return NOT_FOUND for missing keys. Use set to initialize counters first.

Append and Prepend

set log 0 0 6
line-1
STORED

append log 7
,line-2
STORED

get log
VALUE log 0 13
line-1,line-2
END

prepend log 8
header: 
STORED

Touch and Get-and-Touch

# Update TTL without fetching value
touch mykey 120
TOUCHED

# Get value and update TTL simultaneously
gat 300 mykey
VALUE mykey 0 5
world
END

Stats and Version

version
VERSION RedCouch 0.1.0

stats
STAT pid 12345
STAT uptime 42
STAT version RedCouch 0.1.0
STAT cmd_get 5
STAT cmd_set 3
STAT curr_items 2
...
END

Flush

# Flush all RedCouch items (only rc:* keys, not entire Redis DB)
flush_all
OK

Noreply Mode

Most commands accept a noreply suffix that suppresses the server response. This is useful for fire-and-forget writes:

set background-job 0 60 4 noreply
data

No STORED response is sent. If the command is malformed, a CLIENT_ERROR may still be emitted because noreply cannot always be reliably parsed before the error is detected.

Next Steps

Quick Reference

CommandSyntax
setset <key> <flags> <exptime> <bytes> [noreply]\r\n<data>\r\n
addadd <key> <flags> <exptime> <bytes> [noreply]\r\n<data>\r\n
replacereplace <key> <flags> <exptime> <bytes> [noreply]\r\n<data>\r\n
cascas <key> <flags> <exptime> <bytes> <cas_unique> [noreply]\r\n<data>\r\n
appendappend <key> <bytes> [noreply]\r\n<data>\r\n
prependprepend <key> <bytes> [noreply]\r\n<data>\r\n
getget <key> [<key> ...]
getsgets <key> [<key> ...]
gatgat <exptime> <key> [<key> ...]
gatsgats <exptime> <key> [<key> ...]
deletedelete <key> [noreply]
incrincr <key> <value> [noreply]
decrdecr <key> <value> [noreply]
touchtouch <key> <exptime> [noreply]
flush_allflush_all [delay] [noreply]
versionversion
statsstats [group]
verbosityverbosity <level> [noreply]
quitquit