Membase supports the textual memcached protocol as described in protocol.txt. The textual protocol is disabled for the direct port to membase due to the lack of vbucket support in membase. All access to membase with the textual protocol must go through moxi.
One minor difference with Membase compared to memcached is that Membase allows for larger item sizes. Where memcached is 1MByte by default (tunable in more recent versions), Membase defaults to a maximum item size of 20MByte.
In addition to the commands described in the link above, Membase supports the following command extensions:
getl
getl is a "get with lock", and is under
active development. The behavior and command associated with
getl are described on getl extended operations.
Membase supports the binary memcached protocol as described on the wiki for the memcached project except for the range query commands. To date, there are no implementations of the range query commands known, just a draft specification.
In addition to the textual commands described in the link above, Membase supports the following command extensions:
CMD_STOP_PERSISTENCE
@todo add a format description
CMD_START_PERSISTENCE
@todo add a format description
CMD_SET_FLUSH_PARAM
@todo add a format description
CMD_SET_VBUCKET
@todo add a format description
CMD_GET_VBUCKET
@todo add a format description
CMD_DEL_VBUCKET
@todo add a format description
CMD_START_REPLICATION
@todo add a format description
CMD_STOP_REPLICATION
@todo add a format description
CMD_SET_TAP_PARAM
@todo add a format description
CMD_EVICT_KEY
@todo add a format description
memcapable is a tool included in libmemcached that is used to verify if a memcached implementation adheres to the memcached protocol. It does this by sending all of the commands specified in the protocol description and verifies the result. This means that the server must implement an actual item storage and all of the commands to be able to pass the memcapable testsuite.
Command line options
memcapable supports a number of command line options you may find useful (try running memcapable -h to see the list of available options). If you run memcapable without any options it will try to connect to localhost:11211 and run the memcapable testsuite (see the Example section). If you're trying to implement your own server and one of the tests fails, you might want to know why it failed. There is two options you might find useful for that: -v or -c. -v prints out the assertion why the test failed, and may help you figure out the problem. I'm a big fan of debuggers and corefiles, so I prefer -c. When using -c memcapable will dump core whenever a test fails, so you can inspect the corefile to figure out why the test failed.
The following example tests the server listening on port 11211 on the local host (in this example I've got the stock memcached server running there)
trond@opensolaris> memcapable ascii quit [pass] ascii version [pass] ascii verbosity [pass] ascii set [pass] ascii set noreply [pass] ascii get [pass] ascii gets [pass] ascii mget [pass] ascii flush [pass] ascii flush noreply [pass] ascii add [pass] ascii add noreply [pass] ascii replace [pass] ascii replace noreply [pass] ascii cas [pass] ascii cas noreply [pass] ascii delete [pass] ascii delete noreply [pass] ascii incr [pass] ascii incr noreply [pass] ascii decr [pass] ascii decr noreply [pass] ascii append [pass] ascii append noreply [pass] ascii prepend [pass] ascii prepend noreply [pass] ascii stat [pass] binary noop [pass] binary quit [pass] binary quitq [pass] binary set [pass] binary setq [pass] binary flush [pass] binary flushq [pass] binary add [pass] binary addq [pass] binary replace [pass] binary replaceq [pass] binary delete [pass] binary deleteq [pass] binary get [pass] binary getq [pass] binary getk [pass] binary getkq [pass] binary incr [pass] binary incrq [pass] binary decr [pass] binary decrq [pass] binary version [pass] binary append [pass] binary appendq [pass] binary prepend [pass] binary prependq [pass] binary stat [pass] All tests passed
The following example runs the test named "binary prepend"
trond@opensolaris> memcapable -T "binary prepend" binary prepend [pass] All tests passed
The following example runs the test suite, but prompts the user before each test
trond@opensolaris> memcapable -P ascii quit Press <return> when you are ready? ascii quit [pass] ascii version Press <return> when you are ready? quit