Currently the length limit of a key is set at 250 characters (of course, normally clients wouldn't need to use such long keys); the key must not include control characters or whitespace.
The format for keys is listed below. For more information on keys, and how to use them, please see the memcached protocol docs. You can find a list of LiveJournal memcached keys at Section 2, “memcached keys reference”.
<command name> <key> <flags> <exptime> <bytes>\r\n
The key under which the client asks to store the data.
An arbitrary 16-bit unsigned integer (written out in decimal) that the server stores along with the data and sends back when the item is retrieved. Clients may use this as a bit field to store data-specific information; this field is opaque to the server. Note that in memcached 1.2.1 and higher, flags may be 32-bits, instead of 16, but you might want to restrict yourself to 16 bits for compatibility with older versions.
Expiration time. If it is 0, the item never expires
(although it may be deleted from the cache to make place for other
items). If it's non-zero (either
Unix time or offset in seconds from
current time), it is guaranteed that clients will not be able to
retrieve this item after the expiration time arrives (measured by
The number of bytes in the data block to follow, not including the delimiting \r\n. <bytes> may be zero (in which case it's followed by an empty data block).