The two main things to do with a memcached cluster is getting a key and setting a key to a value. Below are examples of this, with parameters explained (something most examples miss for some reason?).
Connect to memcached:
telnet [hostname] [port]
telnet localhost 11211
Getting a key:
get foo # get the key "foo" from memcached
Setting a key:
set [key] [flags] [time-to-live-seconds] [bytes] (newline) [value]
set foo 0 86400 5 # set with a "flag" of 0, a TTL of 86400 seconds and 5 bytes of data hello # value to set is entered on a separate line. Length matches the number 5 above
The “flags” is just a 32-bit integer that is stored (and returned) with the data.
I find the memcached documentation a bit lacking when it comes to finding good summaries with examples of using the different commands. The project uses a wiki for documentation, but I can’t find the stuff that I’m looking for. The way my mind works is, that if I see an example of using something, I can generalize from that (it’s like a one-liner example beats a thousand words).
Below is a good summary with examples of interacting with memcached using telnet. It’s good because the parameters of each command are explained.