1f5e4d26dSAaron Stone<?xml version="1.0" encoding="US-ASCII"?> 2f5e4d26dSAaron Stone<!DOCTYPE rfc SYSTEM "xml2rfc/rfc2629.dtd"> 36fd3c40cSAaron Stone<?xml-stylesheet type='text/xsl' href='xml2rfc/rfc2629.xslt'?> 4f5e4d26dSAaron Stone<?rfc toc="yes"?> 5f5e4d26dSAaron Stone<?rfc strict="yes"?> 6f5e4d26dSAaron Stone<?rfc symrefs="yes"?> 7f5e4d26dSAaron Stone<?rfc sortrefs="yes" ?> 8f5e4d26dSAaron Stone<?rfc compact="yes" ?> 9f5e4d26dSAaron Stone<?rfc subcompact="yes" ?> 10*b1d56b4dSSteve Wills<rfc category="info" docName="draft-stone-memcache-binary-01" ipr="trust200902"> 11f5e4d26dSAaron Stone <front> 12f5e4d26dSAaron Stone <title> Memcache Binary Protocol </title> 13f5e4d26dSAaron Stone 14a41b74dfSTrond Norbye <author fullname="Aaron Stone" surname="Stone" role="editor"> 15f5e4d26dSAaron Stone <organization>Six Apart, Ltd.</organization> 16f5e4d26dSAaron Stone <address> 17f5e4d26dSAaron Stone <postal> 18f5e4d26dSAaron Stone <street>548 4th Street</street> 19f5e4d26dSAaron Stone <city>San Francisco</city> 20f5e4d26dSAaron Stone <region>CA</region> 21f5e4d26dSAaron Stone <code>94107</code> 22f5e4d26dSAaron Stone <country>USA</country> 23f5e4d26dSAaron Stone </postal> 24f5e4d26dSAaron Stone <email>[email protected]</email> 25f5e4d26dSAaron Stone </address> 26f5e4d26dSAaron Stone </author> 27a41b74dfSTrond Norbye <author fullname="Trond Norbye" surname="Norbye" role="editor"> 285da8dbabSTrond Norbye <organization>Sun Microsystems, INC</organization> 295da8dbabSTrond Norbye <address> 305da8dbabSTrond Norbye <postal> 315da8dbabSTrond Norbye <street>Haakon VII g. 7B</street> 325da8dbabSTrond Norbye <city>Trondheim</city> 335da8dbabSTrond Norbye <code>NO-7485 Trondheim</code> 345da8dbabSTrond Norbye <country>Norway</country> 355da8dbabSTrond Norbye </postal> 365da8dbabSTrond Norbye <email>[email protected]</email> 375da8dbabSTrond Norbye </address> 385da8dbabSTrond Norbye </author> 39a41b74dfSTrond Norbye <date day="28" month="August" year="2008" /> 40f5e4d26dSAaron Stone <area>Applications</area> 41f5e4d26dSAaron Stone <keyword>memcache memcached cache</keyword> 42f5e4d26dSAaron Stone <abstract> 43f5e4d26dSAaron Stone <t> 44a41b74dfSTrond Norbye This memo explains the memcache binary protocol for informational 45a41b74dfSTrond Norbye purposes. 46f5e4d26dSAaron Stone </t> 47f5e4d26dSAaron Stone <t> 48f5e4d26dSAaron Stone Memcache is a high performance key-value cache. It is intentionally a 49f5e4d26dSAaron Stone dumb cache, optimized for speed only. Applications using memcache do 50a41b74dfSTrond Norbye not rely on it for data -- a persistent database with guaranteed 51a41b74dfSTrond Norbye reliability is strongly recommended -- but applications can run much 52a41b74dfSTrond Norbye faster when cached data is available in memcache. 53f5e4d26dSAaron Stone </t> 54f5e4d26dSAaron Stone </abstract> 55f5e4d26dSAaron Stone </front> 56f5e4d26dSAaron Stone 57f5e4d26dSAaron Stone <middle> 58f5e4d26dSAaron Stone <section anchor="introduction" title="Introduction"> 59f5e4d26dSAaron Stone <t> 60f5e4d26dSAaron Stone Memcache is a high performance key-value cache. It is intentionally a 6107e6d4fbSEric Lambert dumb cache, optimized for speed only. Applications using memcache should 62a41b74dfSTrond Norbye not rely on it for data -- a persistent database with guaranteed 63a41b74dfSTrond Norbye reliability is strongly recommended -- but applications can run much 64a41b74dfSTrond Norbye faster when cached data is available in memcache. 65f5e4d26dSAaron Stone </t> 66f5e4d26dSAaron Stone <t> 67a41b74dfSTrond Norbye Memcache was originally written to make 6807e6d4fbSEric Lambert <xref target="LJ">LiveJournal</xref> faster. It now powers all of 69a41b74dfSTrond Norbye the fastest web sites that you love. 70f5e4d26dSAaron Stone </t> 71f5e4d26dSAaron Stone <section anchor="conventions" title="Conventions Used In This Document"> 72a41b74dfSTrond Norbye <t> 73a41b74dfSTrond Norbye The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 74f5e4d26dSAaron Stone "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 75a41b74dfSTrond Norbye document are to be interpreted as described in 76a41b74dfSTrond Norbye <xref target="KEYWORDS"/>. 77f5e4d26dSAaron Stone </t> 78f5e4d26dSAaron Stone </section> 79f5e4d26dSAaron Stone </section> 80f5e4d26dSAaron Stone 81f5e4d26dSAaron Stone <section anchor="packet" title="Packet Structure"> 82f5e4d26dSAaron Stone <figure> 83f5e4d26dSAaron Stone <preamble>General format of a packet:</preamble> 84f5e4d26dSAaron Stone <artwork> 85f5e4d26dSAaron Stone Byte/ 0 | 1 | 2 | 3 | 86f5e4d26dSAaron Stone / | | | | 87f5e4d26dSAaron Stone |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 88f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 89f5e4d26dSAaron Stone 0/ HEADER / 90f5e4d26dSAaron Stone / / 91f5e4d26dSAaron Stone / / 92f5e4d26dSAaron Stone / / 93f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 943bc1b80eSTrond Norbye 24/ COMMAND-SPECIFIC EXTRAS (as needed) / 9507e6d4fbSEric Lambert +/ (note length in the extras length header field) / 96f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 97f5e4d26dSAaron Stone m/ Key (as needed) / 98f5e4d26dSAaron Stone +/ (note length in key length header field) / 99f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 100f5e4d26dSAaron Stone n/ Value (as needed) / 101f5e4d26dSAaron Stone +/ (note length is total body length header field, minus / 102f5e4d26dSAaron Stone +/ sum of the extras and key length body fields) / 103f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 1043bc1b80eSTrond Norbye Total 24 bytes 105a41b74dfSTrond Norbye </artwork> 106a41b74dfSTrond Norbye </figure> 107f5e4d26dSAaron Stone 108f5e4d26dSAaron Stone <figure> 109f5e4d26dSAaron Stone <preamble>Request header:</preamble> 110f5e4d26dSAaron Stone <artwork> 111f5e4d26dSAaron Stone Byte/ 0 | 1 | 2 | 3 | 112f5e4d26dSAaron Stone / | | | | 113f5e4d26dSAaron Stone |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 114f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 115f5e4d26dSAaron Stone 0| Magic | Opcode | Key length | 116f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 117f5e4d26dSAaron Stone 4| Extras length | Data type | Reserved | 118f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 119f5e4d26dSAaron Stone 8| Total body length | 120f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 1213bc1b80eSTrond Norbye 12| Opaque | 122f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 1233bc1b80eSTrond Norbye 16| CAS | 1243bc1b80eSTrond Norbye | | 1253bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 1263bc1b80eSTrond Norbye Total 24 bytes 127a41b74dfSTrond Norbye </artwork> 128a41b74dfSTrond Norbye </figure> 129f5e4d26dSAaron Stone 130f5e4d26dSAaron Stone <figure> 131f5e4d26dSAaron Stone <preamble>Response header:</preamble> 132f5e4d26dSAaron Stone <artwork> 133f5e4d26dSAaron Stone Byte/ 0 | 1 | 2 | 3 | 134f5e4d26dSAaron Stone / | | | | 135f5e4d26dSAaron Stone |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 136f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 1373bc1b80eSTrond Norbye 0| Magic | Opcode | Key Length | 138f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 1393bc1b80eSTrond Norbye 4| Extras length | Data type | Status | 140f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 141f5e4d26dSAaron Stone 8| Total body length | 142f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 1433bc1b80eSTrond Norbye 12| Opaque | 144f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 1453bc1b80eSTrond Norbye 16| CAS | 1463bc1b80eSTrond Norbye | | 1473bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 1483bc1b80eSTrond Norbye Total 24 bytes 149a41b74dfSTrond Norbye </artwork> 150a41b74dfSTrond Norbye </figure> 151f5e4d26dSAaron Stone 152f5e4d26dSAaron Stone <t> 153f5e4d26dSAaron Stone Header fields: 154f5e4d26dSAaron Stone <list hangIndent="20" style="hanging"> 155f5e4d26dSAaron Stone <t hangText="Magic">Magic number.</t> 156f5e4d26dSAaron Stone <t hangText="Opcode">Command code.</t> 157f5e4d26dSAaron Stone <t hangText="Key length">Length in bytes of the text key that follows the command extras.</t> 158f5e4d26dSAaron Stone <t hangText="Status">Status of the response (non-zero on error).</t> 159f5e4d26dSAaron Stone <t hangText="Extras length">Length in bytes of the command extras.</t> 160f5e4d26dSAaron Stone <t hangText="Data type">Reserved for future use (Sean is using this soon).</t> 161f5e4d26dSAaron Stone <t hangText="Reserved">Really reserved for future use (up for grabs).</t> 162f5e4d26dSAaron Stone <t hangText="Total body length">Length in bytes of extra + key + value.</t> 163a41b74dfSTrond Norbye <t hangText="Opaque">Will be copied back to you in the response.</t> 16407e6d4fbSEric Lambert <t hangText="CAS">Data version check.</t> 165f5e4d26dSAaron Stone </list> 166f5e4d26dSAaron Stone </t> 167f5e4d26dSAaron Stone </section> 168f5e4d26dSAaron Stone 169f5e4d26dSAaron Stone <section anchor="values" title="Defined Values"> 170f5e4d26dSAaron Stone <section anchor="value-magic" title="Magic Byte"> 171f5e4d26dSAaron Stone <t> 172f5e4d26dSAaron Stone <list hangIndent="8" style="hanging"> 173f5e4d26dSAaron Stone <t hangText="0x80">Request packet for this protocol version</t> 174f5e4d26dSAaron Stone <t hangText="0x81">Response packet for this protocol version</t> 175f5e4d26dSAaron Stone </list> 176f5e4d26dSAaron Stone </t> 177f5e4d26dSAaron Stone 178f5e4d26dSAaron Stone <t> 179f5e4d26dSAaron Stone Magic byte / version. For each version of the protocol, we'll use a 180a41b74dfSTrond Norbye different request/response value pair. This is useful for protocol 18107e6d4fbSEric Lambert analyzers to distinguish the nature of the packet from the direction 18207e6d4fbSEric Lambert which it is moving. Note, it is common to run a memcached instance on 18307e6d4fbSEric Lambert a host that also runs an application server. Such a host will both 18407e6d4fbSEric Lambert send and receive memcache packets. 185f5e4d26dSAaron Stone </t> 186f5e4d26dSAaron Stone 187f5e4d26dSAaron Stone <t> 188f5e4d26dSAaron Stone The version should hopefully correspond only to different meanings of 189f5e4d26dSAaron Stone the command byte. In an ideal world, we will not change the header 190f5e4d26dSAaron Stone format. As reserved bytes are given defined meaning, the protocol 191f5e4d26dSAaron Stone version / magic byte values should be incremented. 192f5e4d26dSAaron Stone </t> 193f5e4d26dSAaron Stone 194f5e4d26dSAaron Stone <t> 195f5e4d26dSAaron Stone Traffic analysis tools are encouraged to identify memcache packets 196f5e4d26dSAaron Stone and provide detailed interpretation if the magic bytes are recognized 19707e6d4fbSEric Lambert and otherwise to provide a generic breakdown of the packet. Note, that 198f5e4d26dSAaron Stone the key and value positions can always be identified even if the magic 199f5e4d26dSAaron Stone byte or command opcode are not recognized. 200f5e4d26dSAaron Stone </t> 201f5e4d26dSAaron Stone </section> 202f5e4d26dSAaron Stone 203f5e4d26dSAaron Stone <section anchor="value-status" title="Response Status"> 204f5e4d26dSAaron Stone <t> 205f5e4d26dSAaron Stone Possible values of this two-byte field: 206f5e4d26dSAaron Stone <list hangIndent="8" style="hanging"> 207f5e4d26dSAaron Stone <t hangText="0x0000">No error</t> 208f5e4d26dSAaron Stone <t hangText="0x0001">Key not found</t> 209f5e4d26dSAaron Stone <t hangText="0x0002">Key exists</t> 21007e6d4fbSEric Lambert <t hangText="0x0003">Value too large</t> 2113bc1b80eSTrond Norbye <t hangText="0x0004">Invalid arguments</t> 2123bc1b80eSTrond Norbye <t hangText="0x0005">Item not stored</t> 213cce46e8fSDustin Sallings <t hangText="0x0006">Incr/Decr on non-numeric value.</t> 2143bc1b80eSTrond Norbye <t hangText="0x0081">Unknown command</t> 2153bc1b80eSTrond Norbye <t hangText="0x0082">Out of memory</t> 216f5e4d26dSAaron Stone </list> 217f5e4d26dSAaron Stone </t> 218f5e4d26dSAaron Stone </section> 219f5e4d26dSAaron Stone 220f5e4d26dSAaron Stone <section anchor="value-opcodes" title="Command Opcodes"> 221f5e4d26dSAaron Stone <t> 222f5e4d26dSAaron Stone Possible values of the one-byte field: 223f5e4d26dSAaron Stone <list hangIndent="8" style="hanging"> 224f5e4d26dSAaron Stone <t hangText="0x00">Get</t> 225f5e4d26dSAaron Stone <t hangText="0x01">Set</t> 226f5e4d26dSAaron Stone <t hangText="0x02">Add</t> 227f5e4d26dSAaron Stone <t hangText="0x03">Replace</t> 228f5e4d26dSAaron Stone <t hangText="0x04">Delete</t> 229f5e4d26dSAaron Stone <t hangText="0x05">Increment</t> 230f5e4d26dSAaron Stone <t hangText="0x06">Decrement</t> 231f5e4d26dSAaron Stone <t hangText="0x07">Quit</t> 232f5e4d26dSAaron Stone <t hangText="0x08">Flush</t> 233f5e4d26dSAaron Stone <t hangText="0x09">GetQ</t> 234f5e4d26dSAaron Stone <t hangText="0x0A">No-op</t> 235f5e4d26dSAaron Stone <t hangText="0x0B">Version</t> 2363bc1b80eSTrond Norbye <t hangText="0x0C">GetK</t> 2373bc1b80eSTrond Norbye <t hangText="0x0D">GetKQ</t> 2383bc1b80eSTrond Norbye <t hangText="0x0E">Append</t> 2393bc1b80eSTrond Norbye <t hangText="0x0F">Prepend</t> 2405da8dbabSTrond Norbye <t hangText="0x10">Stat</t> 2410e8a58a8STrond Norbye <t hangText="0x11">SetQ</t> 2420e8a58a8STrond Norbye <t hangText="0x12">AddQ</t> 2430e8a58a8STrond Norbye <t hangText="0x13">ReplaceQ</t> 2440e8a58a8STrond Norbye <t hangText="0x14">DeleteQ</t> 2450e8a58a8STrond Norbye <t hangText="0x15">IncrementQ</t> 2460e8a58a8STrond Norbye <t hangText="0x16">DecrementQ</t> 2470e8a58a8STrond Norbye <t hangText="0x17">QuitQ</t> 2480e8a58a8STrond Norbye <t hangText="0x18">FlushQ</t> 2490e8a58a8STrond Norbye <t hangText="0x19">AppendQ</t> 2500e8a58a8STrond Norbye <t hangText="0x1A">PrependQ</t> 251f5e4d26dSAaron Stone </list> 252f5e4d26dSAaron Stone </t> 2530e8a58a8STrond Norbye <t> 254b939a46bSDustin Sallings As a convention all of the commands ending with "Q" for 255b939a46bSDustin Sallings Quiet. A quiet version of a command will omit responses 256b939a46bSDustin Sallings that are considered uninteresting. Whether a given response 257b939a46bSDustin Sallings is interesting is dependent upon the command. See the 258b939a46bSDustin Sallings descriptions of the 259b939a46bSDustin Sallings <xref target="command-get">set commands</xref> 260b939a46bSDustin Sallings and <xref target="command-set">set commands</xref> for 261b939a46bSDustin Sallings examples of commands that include quiet variants. 2620e8a58a8STrond Norbye </t> 263f5e4d26dSAaron Stone </section> 264f5e4d26dSAaron Stone 265f5e4d26dSAaron Stone <section anchor="value-types" title="Data Types"> 266f5e4d26dSAaron Stone <t> 267f5e4d26dSAaron Stone Possible values of the one-byte field: 268f5e4d26dSAaron Stone <list hangIndent="8" style="hanging"> 269f5e4d26dSAaron Stone <t hangText="0x00">Raw bytes</t> 270f5e4d26dSAaron Stone </list> 271f5e4d26dSAaron Stone </t> 272f5e4d26dSAaron Stone </section> 273f5e4d26dSAaron Stone </section> 274f5e4d26dSAaron Stone 275f5e4d26dSAaron Stone <section title="Commands"> 276a41b74dfSTrond Norbye <section anchor="command-introduction" title="Introduction"> 277a41b74dfSTrond Norbye <t> 278a41b74dfSTrond Norbye All communication is initiated by a request from the client, 279a41b74dfSTrond Norbye and the server will respond to each request with zero or 28007e6d4fbSEric Lambert multiple packets for each request. If the status code of a response 28107e6d4fbSEric Lambert packet is non-nil, the body of the packet will contain a textual error 28207e6d4fbSEric Lambert message. If the status code is nil, the command opcode will define the 28307e6d4fbSEric Lambert layout of the body of the message. 284a41b74dfSTrond Norbye </t> 285a41b74dfSTrond Norbye <section anchor="command-introduction-example" title="Example"> 286a41b74dfSTrond Norbye <t> 287a41b74dfSTrond Norbye The following figure illustrates the packet layout for 288a41b74dfSTrond Norbye a packet with an error message. 289a41b74dfSTrond Norbye </t> 290a41b74dfSTrond Norbye <figure> 291a41b74dfSTrond Norbye <preamble>Packet layout:</preamble> 292a41b74dfSTrond Norbye <artwork> 293a41b74dfSTrond Norbye 294a41b74dfSTrond Norbye Byte/ 0 | 1 | 2 | 3 | 295a41b74dfSTrond Norbye / | | | | 296a41b74dfSTrond Norbye |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 297a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 298a41b74dfSTrond Norbye 0| 0x81 | 0x00 | 0x00 | 0x00 | 299a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 300a41b74dfSTrond Norbye 4| 0x00 | 0x00 | 0x00 | 0x01 | 301a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 302a41b74dfSTrond Norbye 8| 0x00 | 0x00 | 0x00 | 0x09 | 303a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 304a41b74dfSTrond Norbye 12| 0x00 | 0x00 | 0x00 | 0x00 | 305a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 306a41b74dfSTrond Norbye 16| 0x00 | 0x00 | 0x00 | 0x00 | 307a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 308a41b74dfSTrond Norbye 20| 0x00 | 0x00 | 0x00 | 0x00 | 309a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 310a41b74dfSTrond Norbye 24| 0x4e ('N') | 0x6f ('o') | 0x74 ('t') | 0x20 (' ') | 311a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 312a41b74dfSTrond Norbye 28| 0x66 ('f') | 0x6f ('o') | 0x75 ('u') | 0x6e ('n') | 313a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 314a41b74dfSTrond Norbye 32| 0x64 ('d') | 315a41b74dfSTrond Norbye +---------------+ 316a41b74dfSTrond Norbye Total 33 bytes (24 byte header, and 9 bytes value) 317a41b74dfSTrond Norbye 318a41b74dfSTrond NorbyeField (offset) (value) 319a41b74dfSTrond NorbyeMagic (0) : 0x81 320a41b74dfSTrond NorbyeOpcode (1) : 0x00 321a41b74dfSTrond NorbyeKey length (2,3) : 0x0000 322a41b74dfSTrond NorbyeExtra length (4) : 0x00 323a41b74dfSTrond NorbyeData type (5) : 0x00 324a41b74dfSTrond NorbyeStatus (6,7) : 0x0001 325a41b74dfSTrond NorbyeTotal body (8-11) : 0x00000009 326a41b74dfSTrond NorbyeOpaque (12-15): 0x00000000 327a41b74dfSTrond NorbyeCAS (16-23): 0x0000000000000000 328a41b74dfSTrond NorbyeExtras : None 329a41b74dfSTrond NorbyeKey : None 330a41b74dfSTrond NorbyeValue (24-32): The textual string "Not found" 331a41b74dfSTrond Norbye </artwork> 332a41b74dfSTrond Norbye </figure> 333a41b74dfSTrond Norbye </section> 334a41b74dfSTrond Norbye </section> 335a41b74dfSTrond Norbye 3363bc1b80eSTrond Norbye <section anchor="command-get" title="Get, Get Quietly, Get Key, Get Key Quietly"> 3373bc1b80eSTrond Norbye <t> 3383bc1b80eSTrond Norbye Request: 3393bc1b80eSTrond Norbye </t> 340f5e4d26dSAaron Stone <t> 341f5e4d26dSAaron Stone <list style="empty"> 3423bc1b80eSTrond Norbye <t>MUST NOT have extras.</t> 343f5e4d26dSAaron Stone <t>MUST have key.</t> 344f5e4d26dSAaron Stone <t>MUST NOT have value.</t> 345f5e4d26dSAaron Stone </list> 346f5e4d26dSAaron Stone </t> 347f5e4d26dSAaron Stone 348f5e4d26dSAaron Stone <t> 3493bc1b80eSTrond Norbye Response (if found): 3503bc1b80eSTrond Norbye </t> 3513bc1b80eSTrond Norbye <t> 3523bc1b80eSTrond Norbye <list style="empty"> 3533bc1b80eSTrond Norbye <t>MUST have extras.</t> 3543bc1b80eSTrond Norbye <t>MAY have key.</t> 3553bc1b80eSTrond Norbye <t>MAY have value.</t> 3563bc1b80eSTrond Norbye </list> 3573bc1b80eSTrond Norbye </t> 3583bc1b80eSTrond Norbye 3593bc1b80eSTrond Norbye <t> 3603bc1b80eSTrond Norbye <list style="symbols"> 3613bc1b80eSTrond Norbye <t>4 byte flags</t> 362f5e4d26dSAaron Stone </list> 363f5e4d26dSAaron Stone </t> 364f5e4d26dSAaron Stone 365f5e4d26dSAaron Stone <t> 366f5e4d26dSAaron Stone <figure> 3673bc1b80eSTrond Norbye <preamble>Extra data for the get commands:</preamble> 368f5e4d26dSAaron Stone <artwork> 369f5e4d26dSAaron Stone Byte/ 0 | 1 | 2 | 3 | 370f5e4d26dSAaron Stone / | | | | 371f5e4d26dSAaron Stone |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 372f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 3733bc1b80eSTrond Norbye 0| Flags | 374f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 375a41b74dfSTrond Norbye 3763bc1b80eSTrond Norbye Total 4 bytes 377a41b74dfSTrond Norbye </artwork> 378a41b74dfSTrond Norbye </figure> 379f5e4d26dSAaron Stone </t> 380f5e4d26dSAaron Stone 381f5e4d26dSAaron Stone <t> 382f5e4d26dSAaron Stone The get command gets a single key. The getq command is both mum 383f5e4d26dSAaron Stone on cache miss and quiet, holding its response until a non-quiet 3843bc1b80eSTrond Norbye command is issued. Getk and getkq differs from get and getq by 385a41b74dfSTrond Norbye adding the key into the response packet. 386f5e4d26dSAaron Stone </t> 387f5e4d26dSAaron Stone 388f5e4d26dSAaron Stone <t> 3893bc1b80eSTrond Norbye You're not guaranteed a response to a getq/getkq cache hit until 3903bc1b80eSTrond Norbye you send a non-getq/getkq command later, which uncorks the 39107e6d4fbSEric Lambert server and bundles up IOs to send to the client in one go. 392f5e4d26dSAaron Stone </t> 393f5e4d26dSAaron Stone 394f5e4d26dSAaron Stone <t> 395f5e4d26dSAaron Stone Clients should implement multi-get (still important for 396f5e4d26dSAaron Stone reducing network roundtrips!) as n pipelined requests, the 3973bc1b80eSTrond Norbye first n-1 being getq/getkq, the last being a regular 39807e6d4fbSEric Lambert get/getk. That way you're guaranteed to get a response, and 39907e6d4fbSEric Lambert you know when the server's done. You can also do the naive 4003bc1b80eSTrond Norbye thing and send n pipelined get/getks, but then you could potentially 401a41b74dfSTrond Norbye get back a lot of "NOT_FOUND" error code packets. 40207e6d4fbSEric Lambert Alternatively, you can send 'n' getq/getkqs, followed by a 403a41b74dfSTrond Norbye 'noop' command. 404f5e4d26dSAaron Stone </t> 405f5e4d26dSAaron Stone 406a41b74dfSTrond Norbye <section anchor="command-get-example" title="Example"> 407f5e4d26dSAaron Stone <t> 408a41b74dfSTrond Norbye To request the data associated with the key "Hello" the 409a41b74dfSTrond Norbye following fields must be specified in the packet. 410f5e4d26dSAaron Stone </t> 411f5e4d26dSAaron Stone <figure> 412a41b74dfSTrond Norbye <preamble>get request:</preamble> 413f5e4d26dSAaron Stone <artwork> 414f5e4d26dSAaron Stone Byte/ 0 | 1 | 2 | 3 | 415f5e4d26dSAaron Stone / | | | | 416f5e4d26dSAaron Stone |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 417f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 4183bc1b80eSTrond Norbye 0| 0x80 | 0x00 | 0x00 | 0x05 | 419f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 4203bc1b80eSTrond Norbye 4| 0x00 | 0x00 | 0x00 | 0x00 | 421f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 4223bc1b80eSTrond Norbye 8| 0x00 | 0x00 | 0x00 | 0x05 | 423f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 4243bc1b80eSTrond Norbye 12| 0x00 | 0x00 | 0x00 | 0x00 | 425f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 4263bc1b80eSTrond Norbye 16| 0x00 | 0x00 | 0x00 | 0x00 | 427f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 4283bc1b80eSTrond Norbye 20| 0x00 | 0x00 | 0x00 | 0x00 | 429f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 4303bc1b80eSTrond Norbye 24| 0x48 ('H') | 0x65 ('e') | 0x6c ('l') | 0x6c ('l') | 4313bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 4323bc1b80eSTrond Norbye 28| 0x6f ('o') | 433f5e4d26dSAaron Stone +---------------+ 4343bc1b80eSTrond Norbye 4353bc1b80eSTrond Norbye Total 29 bytes (24 byte header, and 5 bytes key) 436a41b74dfSTrond Norbye 437a41b74dfSTrond NorbyeField (offset) (value) 438a41b74dfSTrond NorbyeMagic (0) : 0x80 439a41b74dfSTrond NorbyeOpcode (1) : 0x00 440a41b74dfSTrond NorbyeKey length (2,3) : 0x0005 441a41b74dfSTrond NorbyeExtra length (4) : 0x00 442a41b74dfSTrond NorbyeData type (5) : 0x00 443a41b74dfSTrond NorbyeReserved (6,7) : 0x0000 444a41b74dfSTrond NorbyeTotal body (8-11) : 0x00000005 445a41b74dfSTrond NorbyeOpaque (12-15): 0x00000000 446a41b74dfSTrond NorbyeCAS (16-23): 0x0000000000000000 447a41b74dfSTrond NorbyeExtras : None 448a41b74dfSTrond NorbyeKey (24-29): The textual string: "Hello" 449a41b74dfSTrond NorbyeValue : None 450a41b74dfSTrond Norbye </artwork> 451a41b74dfSTrond Norbye </figure> 452a41b74dfSTrond Norbye <t>If the item exist on the server the following packet is returned, 453a41b74dfSTrond Norbye otherwise a packet with status code != 0 will be returned (see 454a41b74dfSTrond Norbye <xref target="command-introduction">Introduction</xref>) 455f5e4d26dSAaron Stone </t> 456f5e4d26dSAaron Stone <figure> 457a41b74dfSTrond Norbye <preamble>get/getq response:</preamble> 458f5e4d26dSAaron Stone <artwork> 4593bc1b80eSTrond Norbye 460f5e4d26dSAaron Stone Byte/ 0 | 1 | 2 | 3 | 461f5e4d26dSAaron Stone / | | | | 462f5e4d26dSAaron Stone |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 463f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 4643bc1b80eSTrond Norbye 0| 0x81 | 0x00 | 0x00 | 0x00 | 465f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 466a41b74dfSTrond Norbye 4| 0x04 | 0x00 | 0x00 | 0x00 | 467f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 4683bc1b80eSTrond Norbye 8| 0x00 | 0x00 | 0x00 | 0x09 | 469f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 4703bc1b80eSTrond Norbye 12| 0x00 | 0x00 | 0x00 | 0x00 | 471f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 4723bc1b80eSTrond Norbye 16| 0x00 | 0x00 | 0x00 | 0x00 | 4733bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 474a41b74dfSTrond Norbye 20| 0x00 | 0x00 | 0x00 | 0x01 | 4753bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 476a41b74dfSTrond Norbye 24| 0xde | 0xad | 0xbe | 0xef | 4773bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 478a41b74dfSTrond Norbye 28| 0x57 ('W') | 0x6f ('o') | 0x72 ('r') | 0x6c ('l') | 4793bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 4803bc1b80eSTrond Norbye 32| 0x64 ('d') | 4813bc1b80eSTrond Norbye +---------------+ 4823bc1b80eSTrond Norbye 483a41b74dfSTrond Norbye Total 33 bytes (24 byte header, 4 byte extras and 5 byte value) 4843bc1b80eSTrond Norbye 4853bc1b80eSTrond NorbyeField (offset) (value) 4863bc1b80eSTrond NorbyeMagic (0) : 0x81 4873bc1b80eSTrond NorbyeOpcode (1) : 0x00 4883bc1b80eSTrond NorbyeKey length (2,3) : 0x0000 489a41b74dfSTrond NorbyeExtra length (4) : 0x04 4903bc1b80eSTrond NorbyeData type (5) : 0x00 491a41b74dfSTrond NorbyeStatus (6,7) : 0x0000 4923bc1b80eSTrond NorbyeTotal body (8-11) : 0x00000009 4933bc1b80eSTrond NorbyeOpaque (12-15): 0x00000000 494a41b74dfSTrond NorbyeCAS (16-23): 0x0000000000000001 495a41b74dfSTrond NorbyeExtras : 496a41b74dfSTrond Norbye Flags (24-27): 0xdeadbeef 4973bc1b80eSTrond NorbyeKey : None 498a41b74dfSTrond NorbyeValue (28-32): The textual string "World" 499a41b74dfSTrond Norbye </artwork> 500a41b74dfSTrond Norbye </figure> 501a41b74dfSTrond Norbye <figure> 502a41b74dfSTrond Norbye <preamble>getk/getkq response:</preamble> 503a41b74dfSTrond Norbye <artwork> 504a41b74dfSTrond Norbye 505a41b74dfSTrond Norbye Byte/ 0 | 1 | 2 | 3 | 506a41b74dfSTrond Norbye / | | | | 507a41b74dfSTrond Norbye |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 508a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 509a41b74dfSTrond Norbye 0| 0x81 | 0x00 | 0x00 | 0x05 | 510a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 511a41b74dfSTrond Norbye 4| 0x04 | 0x00 | 0x00 | 0x00 | 512a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 513a41b74dfSTrond Norbye 8| 0x00 | 0x00 | 0x00 | 0x09 | 514a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 515a41b74dfSTrond Norbye 12| 0x00 | 0x00 | 0x00 | 0x00 | 516a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 517a41b74dfSTrond Norbye 16| 0x00 | 0x00 | 0x00 | 0x00 | 518a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 519a41b74dfSTrond Norbye 20| 0x00 | 0x00 | 0x00 | 0x01 | 520a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 521a41b74dfSTrond Norbye 24| 0xde | 0xad | 0xbe | 0xef | 522a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 523a41b74dfSTrond Norbye 28| 0x48 ('H') | 0x65 ('e') | 0x6c ('l') | 0x6c ('l') | 524a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 525a41b74dfSTrond Norbye 32| 0x6f ('o') | 0x57 ('W') | 0x6f ('o') | 0x72 ('r') | 526a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 527a41b74dfSTrond Norbye 36| 0x6c ('l') | 0x64 ('d') | 528a41b74dfSTrond Norbye +---------------+---------------+ 529a41b74dfSTrond Norbye 530a41b74dfSTrond Norbye Total 38 bytes (24 byte header, 4 byte extras, 5 byte key 531a41b74dfSTrond Norbye and 5 byte value) 532a41b74dfSTrond Norbye 533a41b74dfSTrond NorbyeField (offset) (value) 534a41b74dfSTrond NorbyeMagic (0) : 0x81 535a41b74dfSTrond NorbyeOpcode (1) : 0x00 536a41b74dfSTrond NorbyeKey length (2,3) : 0x0005 537a41b74dfSTrond NorbyeExtra length (4) : 0x04 538a41b74dfSTrond NorbyeData type (5) : 0x00 539a41b74dfSTrond NorbyeStatus (6,7) : 0x0000 540a41b74dfSTrond NorbyeTotal body (8-11) : 0x00000009 541a41b74dfSTrond NorbyeOpaque (12-15): 0x00000000 542a41b74dfSTrond NorbyeCAS (16-23): 0x0000000000000001 543a41b74dfSTrond NorbyeExtras : 544a41b74dfSTrond Norbye Flags (24-27): 0xdeadbeef 545a41b74dfSTrond NorbyeKey (28-32): The textual string: "Hello" 54607e6d4fbSEric LambertValue (33-37): The textual string: "World" 547a41b74dfSTrond Norbye </artwork> 548a41b74dfSTrond Norbye </figure> 549a41b74dfSTrond Norbye </section> 550a41b74dfSTrond Norbye </section> 551a41b74dfSTrond Norbye 552a41b74dfSTrond Norbye <section anchor="command-set" title="Set, Add, Replace"> 553a41b74dfSTrond Norbye <t> 554a41b74dfSTrond Norbye <list style="empty"> 555a41b74dfSTrond Norbye <t>MUST have extras.</t> 556a41b74dfSTrond Norbye <t>MUST have key.</t> 557a41b74dfSTrond Norbye <t>MUST have value.</t> 558a41b74dfSTrond Norbye </list> 559f5e4d26dSAaron Stone </t> 560f5e4d26dSAaron Stone 561f5e4d26dSAaron Stone <t> 562a41b74dfSTrond Norbye <list style="symbols"> 563a41b74dfSTrond Norbye <t>4 byte flags</t> 564a41b74dfSTrond Norbye <t>4 byte expiration time</t> 565a41b74dfSTrond Norbye </list> 566a41b74dfSTrond Norbye </t> 5673bc1b80eSTrond Norbye 568a41b74dfSTrond Norbye <figure> 569a41b74dfSTrond Norbye <preamble>Extra data for set/add/replace:</preamble> 570a41b74dfSTrond Norbye <artwork> 571a41b74dfSTrond Norbye Byte/ 0 | 1 | 2 | 3 | 572a41b74dfSTrond Norbye / | | | | 573a41b74dfSTrond Norbye |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 574a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 575a41b74dfSTrond Norbye 0| Flags | 576a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 577a41b74dfSTrond Norbye 4| Expiration | 578a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 579a41b74dfSTrond Norbye Total 8 bytes 580a41b74dfSTrond Norbye </artwork> 581a41b74dfSTrond Norbye </figure> 5823bc1b80eSTrond Norbye 583a41b74dfSTrond Norbye <t> 584a41b74dfSTrond Norbye If the Data Version Check (CAS) is nonzero, the requested 585a41b74dfSTrond Norbye operation MUST only succeed if the item exists and has a CAS value 586a41b74dfSTrond Norbye identical to the provided value. 587a41b74dfSTrond Norbye </t> 5883bc1b80eSTrond Norbye 589a41b74dfSTrond Norbye <t> 590a41b74dfSTrond Norbye Add MUST fail if the item already exist. 591a41b74dfSTrond Norbye </t> 592a41b74dfSTrond Norbye 593a41b74dfSTrond Norbye <t> 594a41b74dfSTrond Norbye Replace MUST fail if the item doesn't exist. 595a41b74dfSTrond Norbye </t> 596a41b74dfSTrond Norbye 597a41b74dfSTrond Norbye <t> 598a41b74dfSTrond Norbye Set should store the data unconditionally if the item exists 59907e6d4fbSEric Lambert or not. 600a41b74dfSTrond Norbye </t> 601a41b74dfSTrond Norbye 602b939a46bSDustin Sallings <t> 603b939a46bSDustin Sallings Quiet mutations only return responses on failure. Success 604b939a46bSDustin Sallings is considered the general case and is suppressed when in 605b939a46bSDustin Sallings quiet mode, but errors should not be allowed to go 606b939a46bSDustin Sallings unnoticed. 607b939a46bSDustin Sallings </t> 608b939a46bSDustin Sallings 609a41b74dfSTrond Norbye <section anchor="command-set-example" title="Example"> 610a41b74dfSTrond Norbye <t>The following figure shows an add-command for 611a41b74dfSTrond Norbye <list style="empty"> 612a41b74dfSTrond Norbye <t>Key: "Hello"</t> 613a41b74dfSTrond Norbye <t>Value: "World"</t> 614a41b74dfSTrond Norbye <t>Flags: 0xdeadbeef</t> 615a41b74dfSTrond Norbye <t>Expiry: in two hours</t> 616a41b74dfSTrond Norbye </list> 617a41b74dfSTrond Norbye </t> 618f5e4d26dSAaron Stone <figure> 6193bc1b80eSTrond Norbye <preamble>Add request:</preamble> 620f5e4d26dSAaron Stone <artwork> 6213bc1b80eSTrond Norbye 622f5e4d26dSAaron Stone Byte/ 0 | 1 | 2 | 3 | 623f5e4d26dSAaron Stone / | | | | 624f5e4d26dSAaron Stone |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 625f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 6263bc1b80eSTrond Norbye 0| 0x80 | 0x02 | 0x00 | 0x05 | 627f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 6283bc1b80eSTrond Norbye 4| 0x08 | 0x00 | 0x00 | 0x00 | 629f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 6303bc1b80eSTrond Norbye 8| 0x00 | 0x00 | 0x00 | 0x12 | 631f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 6323bc1b80eSTrond Norbye 12| 0x00 | 0x00 | 0x00 | 0x00 | 633f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 6343bc1b80eSTrond Norbye 16| 0x00 | 0x00 | 0x00 | 0x00 | 635f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 6363bc1b80eSTrond Norbye 20| 0x00 | 0x00 | 0x00 | 0x00 | 637f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 6383bc1b80eSTrond Norbye 24| 0xde | 0xad | 0xbe | 0xef | 639f5e4d26dSAaron Stone +---------------+---------------+---------------+---------------+ 6403bc1b80eSTrond Norbye 28| 0x00 | 0x00 | 0x0e | 0x10 | 6413bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 6423bc1b80eSTrond Norbye 32| 0x48 ('H') | 0x65 ('e') | 0x6c ('l') | 0x6c ('l') | 6433bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 6443bc1b80eSTrond Norbye 36| 0x6f ('o') | 0x57 ('W') | 0x6f ('o') | 0x72 ('r') | 6453bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 6463bc1b80eSTrond Norbye 40| 0x6c ('l') | 0x64 ('d') | 647f5e4d26dSAaron Stone +---------------+---------------+ 6483bc1b80eSTrond Norbye 649a41b74dfSTrond Norbye Total 42 bytes (24 byte header, 8 byte extras, 5 byte key and 650a41b74dfSTrond Norbye 5 byte value) 6513bc1b80eSTrond Norbye 6523bc1b80eSTrond NorbyeField (offset) (value) 653a41b74dfSTrond NorbyeMagic (0) : 0x80 6543bc1b80eSTrond NorbyeOpcode (1) : 0x02 6553bc1b80eSTrond NorbyeKey length (2,3) : 0x0005 6563bc1b80eSTrond NorbyeExtra length (4) : 0x08 6573bc1b80eSTrond NorbyeData type (5) : 0x00 6583bc1b80eSTrond NorbyeReserved (6,7) : 0x0000 6593bc1b80eSTrond NorbyeTotal body (8-11) : 0x00000012 6603bc1b80eSTrond NorbyeOpaque (12-15): 0x00000000 6613bc1b80eSTrond NorbyeCAS (16-23): 0x0000000000000000 6623bc1b80eSTrond NorbyeExtras : 6633bc1b80eSTrond Norbye Flags (24-27): 0xdeadbeef 6643bc1b80eSTrond Norbye Expiry (28-31): 0x00000e10 6653bc1b80eSTrond NorbyeKey (32-36): The textual string "Hello" 6663bc1b80eSTrond NorbyeValue (37-41): The textual string "World" 667a41b74dfSTrond Norbye </artwork> 668a41b74dfSTrond Norbye </figure> 6693bc1b80eSTrond Norbye <t> 67007e6d4fbSEric Lambert The response-packet contains no extra data, and the result of the 671a41b74dfSTrond Norbye operation is signaled through the status code. If the command 67207e6d4fbSEric Lambert succeeds, the CAS value for the item is returned in the CAS-field 673a41b74dfSTrond Norbye of the packet. 674a41b74dfSTrond Norbye </t> 6753bc1b80eSTrond Norbye <figure> 676a41b74dfSTrond Norbye <preamble>Successful add response:</preamble> 6773bc1b80eSTrond Norbye <artwork> 6783bc1b80eSTrond Norbye 6793bc1b80eSTrond Norbye Byte/ 0 | 1 | 2 | 3 | 6803bc1b80eSTrond Norbye / | | | | 6813bc1b80eSTrond Norbye |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 6823bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 683a41b74dfSTrond Norbye 0| 0x81 | 0x02 | 0x00 | 0x00 | 6843bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 6853bc1b80eSTrond Norbye 4| 0x00 | 0x00 | 0x00 | 0x00 | 6863bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 6873bc1b80eSTrond Norbye 8| 0x00 | 0x00 | 0x00 | 0x00 | 6883bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 6893bc1b80eSTrond Norbye 12| 0x00 | 0x00 | 0x00 | 0x00 | 6903bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 6913bc1b80eSTrond Norbye 16| 0x00 | 0x00 | 0x00 | 0x00 | 6923bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 693a41b74dfSTrond Norbye 20| 0x00 | 0x00 | 0x00 | 0x01 | 6943bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 6953bc1b80eSTrond Norbye 6963bc1b80eSTrond Norbye Total 24 bytes 6973bc1b80eSTrond Norbye 6983bc1b80eSTrond NorbyeField (offset) (value) 6993bc1b80eSTrond NorbyeMagic (0) : 0x81 700a41b74dfSTrond NorbyeOpcode (1) : 0x02 7013bc1b80eSTrond NorbyeKey length (2,3) : 0x0000 7023bc1b80eSTrond NorbyeExtra length (4) : 0x00 7033bc1b80eSTrond NorbyeData type (5) : 0x00 7043bc1b80eSTrond NorbyeStatus (6,7) : 0x0000 7053bc1b80eSTrond NorbyeTotal body (8-11) : 0x00000000 7063bc1b80eSTrond NorbyeOpaque (12-15): 0x00000000 707a41b74dfSTrond NorbyeCAS (16-23): 0x0000000000000001 7083bc1b80eSTrond NorbyeExtras : None 7093bc1b80eSTrond NorbyeKey : None 7103bc1b80eSTrond NorbyeValue : None 711a41b74dfSTrond Norbye </artwork> 712a41b74dfSTrond Norbye </figure> 713a41b74dfSTrond Norbye </section> 714a41b74dfSTrond Norbye </section> 7153bc1b80eSTrond Norbye 716a41b74dfSTrond Norbye <section anchor="command-delete" title="Delete"> 7173bc1b80eSTrond Norbye <t> 718a41b74dfSTrond Norbye <list style="empty"> 71907e6d4fbSEric Lambert <t>MUST NOT have extras.</t> 720a41b74dfSTrond Norbye <t>MUST have key.</t> 721a41b74dfSTrond Norbye <t>MUST NOT have value.</t> 722a41b74dfSTrond Norbye </list> 723a41b74dfSTrond Norbye </t> 7243bc1b80eSTrond Norbye 725a41b74dfSTrond Norbye <t> 726a41b74dfSTrond Norbye Delete the item with the specific key. 727a41b74dfSTrond Norbye </t> 7283bc1b80eSTrond Norbye 729a41b74dfSTrond Norbye <section anchor="command-delete-example" title="Example"> 730a41b74dfSTrond Norbye <t>The following figure shows a delete message for the 73107e6d4fbSEric Lambert item "Hello".</t> 7323bc1b80eSTrond Norbye <figure> 7333bc1b80eSTrond Norbye <preamble>Delete request:</preamble> 7343bc1b80eSTrond Norbye <artwork> 7353bc1b80eSTrond Norbye Byte/ 0 | 1 | 2 | 3 | 7363bc1b80eSTrond Norbye / | | | | 7373bc1b80eSTrond Norbye |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 7383bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 7393bc1b80eSTrond Norbye 0| 0x80 | 0x04 | 0x00 | 0x05 | 7403bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 7413bc1b80eSTrond Norbye 4| 0x00 | 0x00 | 0x00 | 0x00 | 7423bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 7433bc1b80eSTrond Norbye 8| 0x00 | 0x00 | 0x00 | 0x05 | 7443bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 7453bc1b80eSTrond Norbye 12| 0x00 | 0x00 | 0x00 | 0x00 | 7463bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 7473bc1b80eSTrond Norbye 16| 0x00 | 0x00 | 0x00 | 0x00 | 7483bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 7493bc1b80eSTrond Norbye 20| 0x00 | 0x00 | 0x00 | 0x00 | 7503bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 7513bc1b80eSTrond Norbye 24| 0x48 ('H') | 0x65 ('e') | 0x6c ('l') | 0x6c ('l') | 7523bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 7533bc1b80eSTrond Norbye 28| 0x6f ('o') | 7543bc1b80eSTrond Norbye +---------------+ 7553bc1b80eSTrond Norbye 7563bc1b80eSTrond Norbye Total 29 bytes (24 byte header, 5 byte value) 7573bc1b80eSTrond Norbye 7583bc1b80eSTrond NorbyeField (offset) (value) 759a41b74dfSTrond NorbyeMagic (0) : 0x80 7603bc1b80eSTrond NorbyeOpcode (1) : 0x04 761a41b74dfSTrond NorbyeKey length (2,3) : 0x0005 7623bc1b80eSTrond NorbyeExtra length (4) : 0x00 7633bc1b80eSTrond NorbyeData type (5) : 0x00 7643bc1b80eSTrond NorbyeReserved (6,7) : 0x0000 765a41b74dfSTrond NorbyeTotal body (8-11) : 0x00000005 7663bc1b80eSTrond NorbyeOpaque (12-15): 0x00000000 7673bc1b80eSTrond NorbyeCAS (16-23): 0x0000000000000000 7683bc1b80eSTrond NorbyeExtras : None 769a41b74dfSTrond NorbyeKey : The textual string "Hello" 7703bc1b80eSTrond NorbyeValue : None 771a41b74dfSTrond Norbye </artwork> 772a41b74dfSTrond Norbye </figure> 773a41b74dfSTrond Norbye <t> 77407e6d4fbSEric Lambert The response-packet contains no extra data, and the result of the 775a41b74dfSTrond Norbye operation is signaled through the status code. 776a41b74dfSTrond Norbye </t> 777a41b74dfSTrond Norbye </section> 778a41b74dfSTrond Norbye </section> 7793bc1b80eSTrond Norbye 780a41b74dfSTrond Norbye <section anchor="command-incr" title="Increment, Decrement"> 781a41b74dfSTrond Norbye <t> 782a41b74dfSTrond Norbye <list style="empty"> 783a41b74dfSTrond Norbye <t>MUST have extras.</t> 784a41b74dfSTrond Norbye <t>MUST have key.</t> 785a41b74dfSTrond Norbye <t>MUST NOT have value.</t> 786a41b74dfSTrond Norbye </list> 787a41b74dfSTrond Norbye </t> 7883bc1b80eSTrond Norbye 789a41b74dfSTrond Norbye <t> 790a41b74dfSTrond Norbye <list style="symbols"> 791a41b74dfSTrond Norbye <t>8 byte value to add / subtract</t> 792a41b74dfSTrond Norbye <t>8 byte initial value (unsigned)</t> 793a41b74dfSTrond Norbye <t>4 byte expiration time</t> 794a41b74dfSTrond Norbye </list> 795a41b74dfSTrond Norbye </t> 7963bc1b80eSTrond Norbye <figure> 797a41b74dfSTrond Norbye <preamble>Extra data for incr/decr:</preamble> 7983bc1b80eSTrond Norbye <artwork> 7993bc1b80eSTrond Norbye Byte/ 0 | 1 | 2 | 3 | 8003bc1b80eSTrond Norbye / | | | | 8013bc1b80eSTrond Norbye |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 8023bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 803a41b74dfSTrond Norbye 0| Amount to add | 804a41b74dfSTrond Norbye | | 8053bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 806a41b74dfSTrond Norbye 8| Initial value | 807a41b74dfSTrond Norbye | | 8083bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 809a41b74dfSTrond Norbye 16| Expiration | 8103bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 811a41b74dfSTrond Norbye Total 20 bytes 812a41b74dfSTrond Norbye </artwork> 813a41b74dfSTrond Norbye </figure> 8143bc1b80eSTrond Norbye 8153bc1b80eSTrond Norbye <t> 816a41b74dfSTrond Norbye These commands will either add or remove the specified 817a41b74dfSTrond Norbye amount to the requested counter. 818a41b74dfSTrond Norbye </t> 819a41b74dfSTrond Norbye <t> 820a41b74dfSTrond Norbye If the counter does not exist, one of two things may happen: 821a41b74dfSTrond Norbye </t> 822a41b74dfSTrond Norbye <t> 823a41b74dfSTrond Norbye <list style="numbers"> 824a41b74dfSTrond Norbye <t>If the expiration value is all one-bits (0xffffffff), the 825a41b74dfSTrond Norbye operation will fail with NOT_FOUND.</t> 826a41b74dfSTrond Norbye <t>For all other expiration values, the operation will succeed 827a41b74dfSTrond Norbye by seeding the value for this key with the provided initial 828a41b74dfSTrond Norbye value to expire with the provided expiration time. The flags 829a41b74dfSTrond Norbye will be set to zero.</t> 830a41b74dfSTrond Norbye </list> 831a41b74dfSTrond Norbye </t> 8323bc1b80eSTrond Norbye <figure> 833a41b74dfSTrond Norbye <preamble>incr/decr response body:</preamble> 8343bc1b80eSTrond Norbye <artwork> 8353bc1b80eSTrond Norbye Byte/ 0 | 1 | 2 | 3 | 8363bc1b80eSTrond Norbye / | | | | 8373bc1b80eSTrond Norbye |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 8383bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 839a41b74dfSTrond Norbye 0| 64-bit unsigned response. | 840a41b74dfSTrond Norbye | | 8413bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 842a41b74dfSTrond Norbye Total 8 bytes 843a41b74dfSTrond Norbye </artwork> 844a41b74dfSTrond Norbye </figure> 845a41b74dfSTrond Norbye <section anchor="command-incr-example" title="Example"> 846a41b74dfSTrond Norbye <t>The following figure shows an incr-command for 847a41b74dfSTrond Norbye <list style="empty"> 848a41b74dfSTrond Norbye <t>Key: "counter"</t> 849a41b74dfSTrond Norbye <t>Delta: 0x01</t> 850a41b74dfSTrond Norbye <t>Initial: 0x00</t> 851a41b74dfSTrond Norbye <t>Expiry: in two hours</t> 852a41b74dfSTrond Norbye </list> 8533bc1b80eSTrond Norbye </t> 8543bc1b80eSTrond Norbye <figure> 8553bc1b80eSTrond Norbye <preamble>Increment request:</preamble> 8563bc1b80eSTrond Norbye <artwork> 8573bc1b80eSTrond Norbye 8583bc1b80eSTrond Norbye Byte/ 0 | 1 | 2 | 3 | 8593bc1b80eSTrond Norbye / | | | | 8603bc1b80eSTrond Norbye |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 8613bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 8623bc1b80eSTrond Norbye 0| 0x80 | 0x05 | 0x00 | 0x07 | 8633bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 8643bc1b80eSTrond Norbye 4| 0x14 | 0x00 | 0x00 | 0x00 | 8653bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 8663bc1b80eSTrond Norbye 8| 0x00 | 0x00 | 0x00 | 0x1b | 8673bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 8683bc1b80eSTrond Norbye 12| 0x00 | 0x00 | 0x00 | 0x00 | 8693bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 8703bc1b80eSTrond Norbye 16| 0x00 | 0x00 | 0x00 | 0x00 | 8713bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 8723bc1b80eSTrond Norbye 20| 0x00 | 0x00 | 0x00 | 0x00 | 8733bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 8743bc1b80eSTrond Norbye 24| 0x00 | 0x00 | 0x00 | 0x00 | 8753bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 8763bc1b80eSTrond Norbye 28| 0x00 | 0x00 | 0x00 | 0x01 | 8773bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 8783bc1b80eSTrond Norbye 32| 0x00 | 0x00 | 0x00 | 0x00 | 8793bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 8803bc1b80eSTrond Norbye 36| 0x00 | 0x00 | 0x00 | 0x00 | 8813bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 8823bc1b80eSTrond Norbye 40| 0x00 | 0x00 | 0x0e | 0x10 | 8833bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 8843bc1b80eSTrond Norbye 44| 0x63 ('c') | 0x6f ('o') | 0x75 ('u') | 0x6e ('n') | 8853bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 8863bc1b80eSTrond Norbye 48| 0x74 ('t') | 0x65 ('e') | 0x72 ('r') | 8873bc1b80eSTrond Norbye +---------------+---------------+---------------+ 8883bc1b80eSTrond Norbye Total 51 bytes (24 byte header, 20 byte extras, 7 byte key) 8893bc1b80eSTrond Norbye 890a41b74dfSTrond NorbyeField (offset) (value) 891a41b74dfSTrond NorbyeMagic (0) : 0x80 892a41b74dfSTrond NorbyeOpcode (1) : 0x05 893a41b74dfSTrond NorbyeKey length (2,3) : 0x0007 894a41b74dfSTrond NorbyeExtra length (4) : 0x14 895a41b74dfSTrond NorbyeData type (5) : 0x00 896a41b74dfSTrond NorbyeReserved (6,7) : 0x0000 897a41b74dfSTrond NorbyeTotal body (8-11) : 0x0000001b 898a41b74dfSTrond NorbyeOpaque (12-15): 0x00000000 899a41b74dfSTrond NorbyeCAS (16-23): 0x0000000000000000 900a41b74dfSTrond NorbyeExtras : 901a41b74dfSTrond Norbye delta (24-31): 0x0000000000000001 902a41b74dfSTrond Norbye initial (32-39): 0x0000000000000000 903a41b74dfSTrond Norbye exipration (40-43): 0x00000e10 904a41b74dfSTrond NorbyeKey : Textual string "counter" 905a41b74dfSTrond NorbyeValue : None 906a41b74dfSTrond Norbye </artwork> 907a41b74dfSTrond Norbye </figure> 9083bc1b80eSTrond Norbye <t> 909a41b74dfSTrond Norbye If the key doesn't exist, the server will respond with the 910a41b74dfSTrond Norbye initial value. If not the incremented value will be returned. 911a41b74dfSTrond Norbye Let's assume that the key didn't exist, so the initial value 912a41b74dfSTrond Norbye is returned. 913a41b74dfSTrond Norbye </t> 9143bc1b80eSTrond Norbye <figure> 9153bc1b80eSTrond Norbye <preamble>Increment response:</preamble> 9163bc1b80eSTrond Norbye <artwork> 9173bc1b80eSTrond Norbye Byte/ 0 | 1 | 2 | 3 | 9183bc1b80eSTrond Norbye / | | | | 9193bc1b80eSTrond Norbye |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 9203bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 9213bc1b80eSTrond Norbye 0| 0x81 | 0x05 | 0x00 | 0x00 | 9223bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 9233bc1b80eSTrond Norbye 4| 0x00 | 0x00 | 0x00 | 0x00 | 9243bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 9253bc1b80eSTrond Norbye 8| 0x00 | 0x00 | 0x00 | 0x08 | 9263bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 9273bc1b80eSTrond Norbye 12| 0x00 | 0x00 | 0x00 | 0x00 | 9283bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 9293bc1b80eSTrond Norbye 16| 0x00 | 0x00 | 0x00 | 0x00 | 9303bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 9313bc1b80eSTrond Norbye 20| 0x00 | 0x00 | 0x00 | 0x05 | 9323bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 9333bc1b80eSTrond Norbye 24| 0x00 | 0x00 | 0x00 | 0x00 | 9343bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 9353bc1b80eSTrond Norbye 28| 0x00 | 0x00 | 0x00 | 0x00 | 9363bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 9373bc1b80eSTrond Norbye Total 32 bytes (24 byte header, 8 byte value) 9383bc1b80eSTrond Norbye 9393bc1b80eSTrond NorbyeField (offset) (value) 9403bc1b80eSTrond NorbyeMagic (0) : 0x81 9413bc1b80eSTrond NorbyeOpcode (1) : 0x05 9423bc1b80eSTrond NorbyeKey length (2,3) : 0x0000 9433bc1b80eSTrond NorbyeExtra length (4) : 0x00 9443bc1b80eSTrond NorbyeData type (5) : 0x00 9453bc1b80eSTrond NorbyeStatus (6,7) : 0x0000 9463bc1b80eSTrond NorbyeTotal body (8-11) : 0x00000008 9473bc1b80eSTrond NorbyeOpaque (12-15): 0x00000000 9483bc1b80eSTrond NorbyeCAS (16-23): 0x0000000000000005 9493bc1b80eSTrond NorbyeExtras : None 9503bc1b80eSTrond NorbyeKey : None 9513bc1b80eSTrond NorbyeValue : 0x0000000000000000 952a41b74dfSTrond Norbye </artwork> 953a41b74dfSTrond Norbye </figure> 954a41b74dfSTrond Norbye </section> 955a41b74dfSTrond Norbye </section> 956a41b74dfSTrond Norbye 957a41b74dfSTrond Norbye <section anchor="command-quit" title="quit"> 958a41b74dfSTrond Norbye <t> 959a41b74dfSTrond Norbye <list style="empty"> 960a41b74dfSTrond Norbye <t>MUST NOT have extras.</t> 961a41b74dfSTrond Norbye <t>MUST NOT have key.</t> 962a41b74dfSTrond Norbye <t>MUST NOT have value.</t> 963a41b74dfSTrond Norbye </list> 9643bc1b80eSTrond Norbye </t> 9653bc1b80eSTrond Norbye 9663bc1b80eSTrond Norbye <t> 967a41b74dfSTrond Norbye Close the connection to the server. 9683bc1b80eSTrond Norbye </t> 9693bc1b80eSTrond Norbye 970a41b74dfSTrond Norbye <section anchor="command-quit-example" title="Example"> 9713bc1b80eSTrond Norbye <figure> 9723bc1b80eSTrond Norbye <preamble>Quit request:</preamble> 9733bc1b80eSTrond Norbye <artwork> 9743bc1b80eSTrond Norbye Byte/ 0 | 1 | 2 | 3 | 9753bc1b80eSTrond Norbye / | | | | 9763bc1b80eSTrond Norbye |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 9773bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 9783bc1b80eSTrond Norbye 0| 0x80 | 0x07 | 0x00 | 0x00 | 9793bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 9803bc1b80eSTrond Norbye 4| 0x00 | 0x00 | 0x00 | 0x00 | 9813bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 9823bc1b80eSTrond Norbye 8| 0x00 | 0x00 | 0x00 | 0x00 | 9833bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 9843bc1b80eSTrond Norbye 12| 0x00 | 0x00 | 0x00 | 0x00 | 9853bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 9863bc1b80eSTrond Norbye 16| 0x00 | 0x00 | 0x00 | 0x00 | 9873bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 9883bc1b80eSTrond Norbye 20| 0x00 | 0x00 | 0x00 | 0x00 | 9893bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 9903bc1b80eSTrond Norbye Total 24 bytes 991a41b74dfSTrond Norbye 992a41b74dfSTrond NorbyeField (offset) (value) 993a41b74dfSTrond NorbyeMagic (0) : 0x80 994a41b74dfSTrond NorbyeOpcode (1) : 0x07 995a41b74dfSTrond NorbyeKey length (2,3) : 0x0000 996a41b74dfSTrond NorbyeExtra length (4) : 0x00 997a41b74dfSTrond NorbyeData type (5) : 0x00 998a41b74dfSTrond NorbyeReserved (6,7) : 0x0000 999a41b74dfSTrond NorbyeTotal body (8-11) : 0x00000000 1000a41b74dfSTrond NorbyeOpaque (12-15): 0x00000000 1001a41b74dfSTrond NorbyeCAS (16-23): 0x0000000000000000 1002a41b74dfSTrond NorbyeExtras : None 1003a41b74dfSTrond NorbyeKey : None 1004a41b74dfSTrond NorbyeValue : None 1005a41b74dfSTrond Norbye </artwork> 1006a41b74dfSTrond Norbye </figure> 1007a41b74dfSTrond Norbye <t> 100807e6d4fbSEric Lambert The response-packet contains no extra data, and the result of the 1009a41b74dfSTrond Norbye operation is signaled through the status code. The server will 1010a41b74dfSTrond Norbye then close the connection. 1011a41b74dfSTrond Norbye </t> 1012a41b74dfSTrond Norbye </section> 1013a41b74dfSTrond Norbye </section> 1014a41b74dfSTrond Norbye 1015a41b74dfSTrond Norbye <section anchor="command-flush" title="Flush"> 1016a41b74dfSTrond Norbye <t> 1017a41b74dfSTrond Norbye <list style="empty"> 101807e6d4fbSEric Lambert <t>MAY have extras.</t> 1019a41b74dfSTrond Norbye <t>MUST NOT have key.</t> 1020a41b74dfSTrond Norbye <t>MUST NOT have value.</t> 1021a41b74dfSTrond Norbye </list> 1022a41b74dfSTrond Norbye </t> 10233bc1b80eSTrond Norbye 10243bc1b80eSTrond Norbye <t> 1025a41b74dfSTrond Norbye <list style="symbols"> 1026a41b74dfSTrond Norbye <t>4 byte expiration time</t> 1027a41b74dfSTrond Norbye </list> 1028a41b74dfSTrond Norbye </t> 10293bc1b80eSTrond Norbye <figure> 1030a41b74dfSTrond Norbye <preamble>Extra data for flush:</preamble> 10313bc1b80eSTrond Norbye <artwork> 10323bc1b80eSTrond Norbye Byte/ 0 | 1 | 2 | 3 | 10333bc1b80eSTrond Norbye / | | | | 10343bc1b80eSTrond Norbye |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 10353bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 1036a41b74dfSTrond Norbye 0| Expiration | 1037a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1038a41b74dfSTrond Norbye Total 4 bytes 1039a41b74dfSTrond Norbye </artwork> 1040a41b74dfSTrond Norbye </figure> 1041a41b74dfSTrond Norbye <t> 104207e6d4fbSEric Lambert Flush the items in the cache now or some time in the future as 1043a41b74dfSTrond Norbye specified by the expiration field. See the documentation of the 1044a41b74dfSTrond Norbye textual protocol for the full description on how to specify the 1045a41b74dfSTrond Norbye expiration time. 1046a41b74dfSTrond Norbye </t> 1047a41b74dfSTrond Norbye <section anchor="command-flush-example" title="Example"> 1048a41b74dfSTrond Norbye <t> 1049a41b74dfSTrond Norbye To flush the cache (delete all items) in two hours, the set 1050a41b74dfSTrond Norbye the following values in the request 1051a41b74dfSTrond Norbye </t> 1052a41b74dfSTrond Norbye <figure> 1053a41b74dfSTrond Norbye <preamble>Flush request:</preamble> 1054a41b74dfSTrond Norbye <artwork> 1055a41b74dfSTrond Norbye Byte/ 0 | 1 | 2 | 3 | 1056a41b74dfSTrond Norbye / | | | | 1057a41b74dfSTrond Norbye |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 1058a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1059a41b74dfSTrond Norbye 0| 0x80 | 0x08 | 0x00 | 0x00 | 1060a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1061a41b74dfSTrond Norbye 4| 0x04 | 0x00 | 0x00 | 0x00 | 1062a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1063a41b74dfSTrond Norbye 8| 0x00 | 0x00 | 0x00 | 0x04 | 1064a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1065a41b74dfSTrond Norbye 12| 0x00 | 0x00 | 0x00 | 0x00 | 1066a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1067a41b74dfSTrond Norbye 16| 0x00 | 0x00 | 0x00 | 0x00 | 1068a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1069a41b74dfSTrond Norbye 20| 0x00 | 0x00 | 0x00 | 0x00 | 1070a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1071a41b74dfSTrond Norbye 24| 0x00 | 0x00 | 0x0e | 0x10 | 1072a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1073a41b74dfSTrond Norbye Total 28 bytes (24 byte header, 4 byte body) 1074a41b74dfSTrond Norbye 1075a41b74dfSTrond NorbyeField (offset) (value) 1076a41b74dfSTrond NorbyeMagic (0) : 0x80 1077a41b74dfSTrond NorbyeOpcode (1) : 0x08 1078a41b74dfSTrond NorbyeKey length (2,3) : 0x0000 1079a41b74dfSTrond NorbyeExtra length (4) : 0x04 1080a41b74dfSTrond NorbyeData type (5) : 0x00 1081a41b74dfSTrond NorbyeReserved (6,7) : 0x0000 1082a41b74dfSTrond NorbyeTotal body (8-11) : 0x00000004 1083a41b74dfSTrond NorbyeOpaque (12-15): 0x00000000 1084a41b74dfSTrond NorbyeCAS (16-23): 0x0000000000000000 1085a41b74dfSTrond NorbyeExtras : 1086a41b74dfSTrond Norbye Expiry (24-27): 0x000e10 1087a41b74dfSTrond NorbyeKey : None 1088a41b74dfSTrond NorbyeValue : None 1089a41b74dfSTrond Norbye </artwork> 1090a41b74dfSTrond Norbye </figure> 1091a41b74dfSTrond Norbye <t> 109207e6d4fbSEric Lambert The response-packet contains no extra data, and the result of the 1093a41b74dfSTrond Norbye operation is signaled through the status code. 1094a41b74dfSTrond Norbye </t> 1095a41b74dfSTrond Norbye </section> 1096a41b74dfSTrond Norbye </section> 1097a41b74dfSTrond Norbye <section anchor="command-noop" title="noop"> 1098a41b74dfSTrond Norbye <t> 1099a41b74dfSTrond Norbye <list style="empty"> 1100a41b74dfSTrond Norbye <t>MUST NOT have extras.</t> 1101a41b74dfSTrond Norbye <t>MUST NOT have key.</t> 1102a41b74dfSTrond Norbye <t>MUST NOT have value.</t> 1103a41b74dfSTrond Norbye </list> 1104a41b74dfSTrond Norbye </t> 1105a41b74dfSTrond Norbye 1106a41b74dfSTrond Norbye <t> 1107a41b74dfSTrond Norbye Used as a keep alive. Flushes outstanding getq/getkq's. 1108a41b74dfSTrond Norbye </t> 1109a41b74dfSTrond Norbye <section anchor="command-noop-example" title="Example"> 1110a41b74dfSTrond Norbye <figure> 1111a41b74dfSTrond Norbye <preamble>Noop request:</preamble> 1112a41b74dfSTrond Norbye <artwork> 1113a41b74dfSTrond Norbye Byte/ 0 | 1 | 2 | 3 | 1114a41b74dfSTrond Norbye / | | | | 1115a41b74dfSTrond Norbye |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 1116a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1117a41b74dfSTrond Norbye 0| 0x80 | 0x0a | 0x00 | 0x00 | 11183bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 11193bc1b80eSTrond Norbye 4| 0x00 | 0x00 | 0x00 | 0x00 | 11203bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 11213bc1b80eSTrond Norbye 8| 0x00 | 0x00 | 0x00 | 0x00 | 11223bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 11233bc1b80eSTrond Norbye 12| 0x00 | 0x00 | 0x00 | 0x00 | 11243bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 11253bc1b80eSTrond Norbye 16| 0x00 | 0x00 | 0x00 | 0x00 | 11263bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 11273bc1b80eSTrond Norbye 20| 0x00 | 0x00 | 0x00 | 0x00 | 11283bc1b80eSTrond Norbye +---------------+---------------+---------------+---------------+ 11293bc1b80eSTrond Norbye Total 24 bytes 11303bc1b80eSTrond Norbye 11313bc1b80eSTrond NorbyeField (offset) (value) 1132a41b74dfSTrond NorbyeMagic (0) : 0x80 1133a41b74dfSTrond NorbyeOpcode (1) : 0x0a 11343bc1b80eSTrond NorbyeKey length (2,3) : 0x0000 11353bc1b80eSTrond NorbyeExtra length (4) : 0x00 11363bc1b80eSTrond NorbyeData type (5) : 0x00 1137a41b74dfSTrond NorbyeReserved (6,7) : 0x0000 11383bc1b80eSTrond NorbyeTotal body (8-11) : 0x00000000 11393bc1b80eSTrond NorbyeOpaque (12-15): 0x00000000 11403bc1b80eSTrond NorbyeCAS (16-23): 0x0000000000000000 11413bc1b80eSTrond NorbyeExtras : None 11423bc1b80eSTrond NorbyeKey : None 11433bc1b80eSTrond NorbyeValue : None 1144a41b74dfSTrond Norbye </artwork> 1145a41b74dfSTrond Norbye </figure> 1146a41b74dfSTrond Norbye <t> 114707e6d4fbSEric Lambert The response-packet contains no extra data, and the result of the 1148a41b74dfSTrond Norbye operation is signaled through the status code. 1149f5e4d26dSAaron Stone </t> 1150f5e4d26dSAaron Stone </section> 1151a41b74dfSTrond Norbye </section> 1152f5e4d26dSAaron Stone 1153a41b74dfSTrond Norbye <section anchor="command-version" title="version"> 1154a41b74dfSTrond Norbye <t> 1155a41b74dfSTrond Norbye <list style="empty"> 1156a41b74dfSTrond Norbye <t>MUST NOT have extras.</t> 1157a41b74dfSTrond Norbye <t>MUST NOT have key.</t> 1158a41b74dfSTrond Norbye <t>MUST NOT have value.</t> 1159a41b74dfSTrond Norbye </list> 1160a41b74dfSTrond Norbye </t> 1161a41b74dfSTrond Norbye 1162a41b74dfSTrond Norbye <t> 1163a41b74dfSTrond Norbye Request the server version. 1164a41b74dfSTrond Norbye </t> 1165a41b74dfSTrond Norbye <t> 116607e6d4fbSEric Lambert The server responds with a packet containing the version string 1167a41b74dfSTrond Norbye in the body with the following format: "x.y.z" 1168a41b74dfSTrond Norbye </t> 1169a41b74dfSTrond Norbye <section anchor="command-version-example" title="Example"> 1170a41b74dfSTrond Norbye <figure> 1171a41b74dfSTrond Norbye <preamble>Version request:</preamble> 1172a41b74dfSTrond Norbye <artwork> 1173a41b74dfSTrond Norbye Byte/ 0 | 1 | 2 | 3 | 1174a41b74dfSTrond Norbye / | | | | 1175a41b74dfSTrond Norbye |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 1176a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1177a41b74dfSTrond Norbye 0| 0x80 | 0x0b | 0x00 | 0x00 | 1178a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1179a41b74dfSTrond Norbye 4| 0x00 | 0x00 | 0x00 | 0x00 | 1180a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1181a41b74dfSTrond Norbye 8| 0x00 | 0x00 | 0x00 | 0x00 | 1182a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1183a41b74dfSTrond Norbye 12| 0x00 | 0x00 | 0x00 | 0x00 | 1184a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1185a41b74dfSTrond Norbye 16| 0x00 | 0x00 | 0x00 | 0x00 | 1186a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1187a41b74dfSTrond Norbye 20| 0x00 | 0x00 | 0x00 | 0x00 | 1188a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1189a41b74dfSTrond Norbye Total 24 bytes 1190a41b74dfSTrond Norbye 1191a41b74dfSTrond NorbyeField (offset) (value) 1192a41b74dfSTrond NorbyeMagic (0) : 0x80 1193a41b74dfSTrond NorbyeOpcode (1) : 0x0b 1194a41b74dfSTrond NorbyeKey length (2,3) : 0x0000 1195a41b74dfSTrond NorbyeExtra length (4) : 0x00 1196a41b74dfSTrond NorbyeData type (5) : 0x00 1197a41b74dfSTrond NorbyeReserved (6,7) : 0x0000 1198a41b74dfSTrond NorbyeTotal body (8-11) : 0x00000000 1199a41b74dfSTrond NorbyeOpaque (12-15): 0x00000000 1200a41b74dfSTrond NorbyeCAS (16-23): 0x0000000000000000 1201a41b74dfSTrond NorbyeExtras : None 1202a41b74dfSTrond Norbye </artwork> 1203a41b74dfSTrond Norbye </figure> 1204a41b74dfSTrond Norbye <figure> 1205a41b74dfSTrond Norbye <preamble>Version response:</preamble> 1206a41b74dfSTrond Norbye <artwork> 1207a41b74dfSTrond Norbye Byte/ 0 | 1 | 2 | 3 | 1208a41b74dfSTrond Norbye / | | | | 1209a41b74dfSTrond Norbye |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 1210a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1211a41b74dfSTrond Norbye 0| 0x81 | 0x0b | 0x00 | 0x00 | 1212a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1213a41b74dfSTrond Norbye 4| 0x00 | 0x00 | 0x00 | 0x00 | 1214a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1215a41b74dfSTrond Norbye 8| 0x00 | 0x00 | 0x00 | 0x05 | 1216a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1217a41b74dfSTrond Norbye 12| 0x00 | 0x00 | 0x00 | 0x00 | 1218a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1219a41b74dfSTrond Norbye 16| 0x00 | 0x00 | 0x00 | 0x00 | 1220a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1221a41b74dfSTrond Norbye 20| 0x00 | 0x00 | 0x00 | 0x00 | 1222a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1223a41b74dfSTrond Norbye 24| 0x31 ('1') | 0x2e ('.') | 0x33 ('3') | 0x2e ('.') | 1224a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1225a41b74dfSTrond Norbye 28| 0x31 ('1') | 1226a41b74dfSTrond Norbye +---------------+ 1227a41b74dfSTrond Norbye Total 29 bytes (24 byte header, 5 byte body) 1228a41b74dfSTrond Norbye 1229a41b74dfSTrond NorbyeField (offset) (value) 1230a41b74dfSTrond NorbyeMagic (0) : 0x81 1231a41b74dfSTrond NorbyeOpcode (1) : 0x0b 1232a41b74dfSTrond NorbyeKey length (2,3) : 0x0000 1233a41b74dfSTrond NorbyeExtra length (4) : 0x00 1234a41b74dfSTrond NorbyeData type (5) : 0x00 1235a41b74dfSTrond NorbyeStatus (6,7) : 0x0000 1236a41b74dfSTrond NorbyeTotal body (8-11) : 0x00000005 1237a41b74dfSTrond NorbyeOpaque (12-15): 0x00000000 1238a41b74dfSTrond NorbyeCAS (16-23): 0x0000000000000000 1239a41b74dfSTrond NorbyeExtras : None 1240a41b74dfSTrond NorbyeKey : None 1241a41b74dfSTrond NorbyeValue : Textual string "1.3.1" 1242a41b74dfSTrond Norbye </artwork> 1243a41b74dfSTrond Norbye </figure> 1244a41b74dfSTrond Norbye </section> 1245a41b74dfSTrond Norbye </section> 1246a41b74dfSTrond Norbye 1247a41b74dfSTrond Norbye <section anchor="command-append" title="Append, Prepend"> 1248a41b74dfSTrond Norbye <t> 1249a41b74dfSTrond Norbye <list style="empty"> 1250a41b74dfSTrond Norbye <t>MUST NOT have extras.</t> 1251a41b74dfSTrond Norbye <t>MUST have key.</t> 1252a41b74dfSTrond Norbye <t>MUST have value.</t> 1253a41b74dfSTrond Norbye </list> 1254a41b74dfSTrond Norbye </t> 1255a41b74dfSTrond Norbye 1256a41b74dfSTrond Norbye <t> 1257a41b74dfSTrond Norbye These commands will either append or prepend the specified 1258a41b74dfSTrond Norbye value to the requested key. 1259a41b74dfSTrond Norbye </t> 1260a41b74dfSTrond Norbye 1261a41b74dfSTrond Norbye <section anchor="command-append-example" title="Example"> 1262a41b74dfSTrond Norbye <t>The following example appends '!' to the 'Hello' key.</t> 1263a41b74dfSTrond Norbye <figure> 1264a41b74dfSTrond Norbye <preamble>Append request:</preamble> 1265a41b74dfSTrond Norbye <artwork> 1266a41b74dfSTrond Norbye Byte/ 0 | 1 | 2 | 3 | 1267a41b74dfSTrond Norbye / | | | | 1268a41b74dfSTrond Norbye |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 1269a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1270a41b74dfSTrond Norbye 0| 0x80 | 0x0e | 0x00 | 0x05 | 1271a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1272a41b74dfSTrond Norbye 4| 0x00 | 0x00 | 0x00 | 0x00 | 1273a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1274a41b74dfSTrond Norbye 8| 0x00 | 0x00 | 0x00 | 0x06 | 1275a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1276a41b74dfSTrond Norbye 12| 0x00 | 0x00 | 0x00 | 0x00 | 1277a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1278a41b74dfSTrond Norbye 16| 0x00 | 0x00 | 0x00 | 0x00 | 1279a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1280a41b74dfSTrond Norbye 20| 0x00 | 0x00 | 0x00 | 0x00 | 1281a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1282a41b74dfSTrond Norbye 24| 0x48 ('H') | 0x65 ('e') | 0x6c ('l') | 0x6c ('l') | 1283a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1284a41b74dfSTrond Norbye 28| 0x6f ('o') | 0x21 ('!') | 1285a41b74dfSTrond Norbye +---------------+---------------+ 1286a41b74dfSTrond Norbye Total 30 bytes (24 byte header, 5 byte key, 1 byte value) 1287a41b74dfSTrond Norbye 1288a41b74dfSTrond NorbyeField (offset) (value) 1289a41b74dfSTrond NorbyeMagic (0) : 0x80 1290a41b74dfSTrond NorbyeOpcode (1) : 0x0e 1291a41b74dfSTrond NorbyeKey length (2,3) : 0x0005 1292a41b74dfSTrond NorbyeExtra length (4) : 0x00 1293a41b74dfSTrond NorbyeData type (5) : 0x00 1294a41b74dfSTrond NorbyeReserved (6,7) : 0x0000 1295a41b74dfSTrond NorbyeTotal body (8-11) : 0x00000006 1296a41b74dfSTrond NorbyeOpaque (12-15): 0x00000000 1297a41b74dfSTrond NorbyeCAS (16-23): 0x0000000000000000 1298a41b74dfSTrond NorbyeExtras : None 1299a41b74dfSTrond NorbyeKey (24-28): The textual string "Hello" 1300a41b74dfSTrond NorbyeValue (29) : "!" 1301a41b74dfSTrond Norbye </artwork> 1302a41b74dfSTrond Norbye </figure> 1303a41b74dfSTrond Norbye <t> 130407e6d4fbSEric Lambert The response-packet contains no extra data, and the result of the 1305a41b74dfSTrond Norbye operation is signaled through the status code. 1306a41b74dfSTrond Norbye </t> 1307a41b74dfSTrond Norbye </section> 1308a41b74dfSTrond Norbye </section> 1309a41b74dfSTrond Norbye 1310a41b74dfSTrond Norbye <section anchor="command-stat" title="Stat"> 1311a41b74dfSTrond Norbye <t> 1312a41b74dfSTrond Norbye <list style="empty"> 1313a41b74dfSTrond Norbye <t>MUST NOT have extras.</t> 1314a41b74dfSTrond Norbye <t>MAY have key.</t> 1315a41b74dfSTrond Norbye <t>MUST NOT have value.</t> 1316a41b74dfSTrond Norbye </list> 1317a41b74dfSTrond Norbye </t> 1318a41b74dfSTrond Norbye 1319a41b74dfSTrond Norbye <t> 1320a41b74dfSTrond Norbye Request server statistics. Without a key specified the server will 1321a41b74dfSTrond Norbye respond with a "default" set of statistics information. Each piece 132207e6d4fbSEric Lambert of statistical information is returned in its own packet (key 1323a41b74dfSTrond Norbye contains the name of the statistical item and the body contains the 132407e6d4fbSEric Lambert value in ASCII format). The sequence of return packets is terminated 132507e6d4fbSEric Lambert with a packet that contains no key and no value. 1326a41b74dfSTrond Norbye </t> 1327a41b74dfSTrond Norbye <section anchor="command-stat-example" title="Example"> 1328a41b74dfSTrond Norbye <t>The following example requests all statistics from the server</t> 1329a41b74dfSTrond Norbye <figure> 1330a41b74dfSTrond Norbye <preamble>Stat request:</preamble> 1331a41b74dfSTrond Norbye <artwork> 1332a41b74dfSTrond Norbye Byte/ 0 | 1 | 2 | 3 | 1333a41b74dfSTrond Norbye / | | | | 1334a41b74dfSTrond Norbye |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 1335a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1336a41b74dfSTrond Norbye 0| 0x80 | 0x10 | 0x00 | 0x00 | 1337a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1338a41b74dfSTrond Norbye 4| 0x00 | 0x00 | 0x00 | 0x00 | 1339a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1340a41b74dfSTrond Norbye 8| 0x00 | 0x00 | 0x00 | 0x00 | 1341a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1342a41b74dfSTrond Norbye 12| 0x00 | 0x00 | 0x00 | 0x00 | 1343a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1344a41b74dfSTrond Norbye 16| 0x00 | 0x00 | 0x00 | 0x00 | 1345a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1346a41b74dfSTrond Norbye 20| 0x00 | 0x00 | 0x00 | 0x00 | 1347a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1348a41b74dfSTrond Norbye Total 24 bytes 1349a41b74dfSTrond Norbye 1350a41b74dfSTrond NorbyeField (offset) (value) 1351a41b74dfSTrond NorbyeMagic (0) : 0x80 1352a41b74dfSTrond NorbyeOpcode (1) : 0x10 1353a41b74dfSTrond NorbyeKey length (2,3) : 0x0000 1354a41b74dfSTrond NorbyeExtra length (4) : 0x00 1355a41b74dfSTrond NorbyeData type (5) : 0x00 1356a41b74dfSTrond NorbyeReserved (6,7) : 0x0000 1357a41b74dfSTrond NorbyeTotal body (8-11) : 0x00000000 1358a41b74dfSTrond NorbyeOpaque (12-15): 0x00000000 1359a41b74dfSTrond NorbyeCAS (16-23): 0x0000000000000000 1360a41b74dfSTrond NorbyeExtras : None 1361a41b74dfSTrond NorbyeKey : None 1362a41b74dfSTrond NorbyeValue : None 1363a41b74dfSTrond Norbye </artwork> 1364a41b74dfSTrond Norbye </figure> 1365a41b74dfSTrond Norbye <t> 136607e6d4fbSEric Lambert The server will send each value in a separate packet with 1367a41b74dfSTrond Norbye an "empty" packet (no key / no value) to terminate the sequence. 1368a41b74dfSTrond Norbye Each of the response packets look like the following example: 1369a41b74dfSTrond Norbye </t> 1370a41b74dfSTrond Norbye <figure> 1371a41b74dfSTrond Norbye <preamble>Stat response:</preamble> 1372a41b74dfSTrond Norbye <artwork> 1373a41b74dfSTrond Norbye Byte/ 0 | 1 | 2 | 3 | 1374a41b74dfSTrond Norbye / | | | | 1375a41b74dfSTrond Norbye |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7| 1376a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1377a41b74dfSTrond Norbye 0| 0x81 | 0x10 | 0x00 | 0x03 | 1378a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1379a41b74dfSTrond Norbye 4| 0x00 | 0x00 | 0x00 | 0x00 | 1380a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1381a41b74dfSTrond Norbye 8| 0x00 | 0x00 | 0x00 | 0x07 | 1382a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1383a41b74dfSTrond Norbye 12| 0x00 | 0x00 | 0x00 | 0x00 | 1384a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1385a41b74dfSTrond Norbye 16| 0x00 | 0x00 | 0x00 | 0x00 | 1386a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1387a41b74dfSTrond Norbye 20| 0x00 | 0x00 | 0x00 | 0x00 | 1388a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1389a41b74dfSTrond Norbye 24| 0x70 ('p') | 0x69 ('i') | 0x64 ('d') | 0x33 ('3') | 1390a41b74dfSTrond Norbye +---------------+---------------+---------------+---------------+ 1391a41b74dfSTrond Norbye 28| 0x30 ('0') | 0x37 ('7') | 0x38 ('8') | 1392a41b74dfSTrond Norbye +---------------+---------------+---------------+ 1393a41b74dfSTrond Norbye Total 31 bytes (24 byte header, 3 byte key, 4 byte body) 1394a41b74dfSTrond Norbye 1395a41b74dfSTrond NorbyeField (offset) (value) 1396a41b74dfSTrond NorbyeMagic (0) : 0x81 1397a41b74dfSTrond NorbyeOpcode (1) : 0x10 1398a41b74dfSTrond NorbyeKey length (2,3) : 0x0003 1399a41b74dfSTrond NorbyeExtra length (4) : 0x00 1400a41b74dfSTrond NorbyeData type (5) : 0x00 1401a41b74dfSTrond NorbyeStatus (6,7) : 0x0000 1402a41b74dfSTrond NorbyeTotal body (8-11) : 0x00000007 1403a41b74dfSTrond NorbyeOpaque (12-15): 0x00000000 1404a41b74dfSTrond NorbyeCAS (16-23): 0x0000000000000000 1405a41b74dfSTrond NorbyeExstras : None 1406a41b74dfSTrond NorbyeKey : The textual string "pid" 1407a41b74dfSTrond NorbyeValue : The textual string "3078" 1408a41b74dfSTrond Norbye </artwork> 1409a41b74dfSTrond Norbye </figure> 1410a41b74dfSTrond Norbye </section> 1411a41b74dfSTrond Norbye </section> 1412a41b74dfSTrond Norbye </section> 1413f5e4d26dSAaron Stone <section anchor="security" title="Security Considerations"> 1414f5e4d26dSAaron Stone <t> 1415f5e4d26dSAaron Stone Memcache has no authentication or security layers whatsoever. It is 1416f5e4d26dSAaron Stone RECOMMENDED that memcache be deployed strictly on closed, protected, 1417f5e4d26dSAaron Stone back-end networks within a single data center, within a single cluster of 1418f5e4d26dSAaron Stone servers, or even on a single host, providing shared caching for multiple 1419f5e4d26dSAaron Stone applications. Memcache MUST NOT be made available on a public network. 1420f5e4d26dSAaron Stone </t> 1421f5e4d26dSAaron Stone </section> 1422f5e4d26dSAaron Stone 1423f5e4d26dSAaron Stone </middle> 1424f5e4d26dSAaron Stone 1425f5e4d26dSAaron Stone <back> 1426f5e4d26dSAaron Stone <references title="Normative References"> 1427f5e4d26dSAaron Stone <reference anchor="LJ"> 1428f5e4d26dSAaron Stone <front> 1429f5e4d26dSAaron Stone <title>LJ NEEDS MOAR SPEED</title> 1430f5e4d26dSAaron Stone <author fullname="Brad Fitzpatrick"> 1431f5e4d26dSAaron Stone <organization>Danga Interactive</organization> 1432f5e4d26dSAaron Stone </author> 1433f5e4d26dSAaron Stone <date day="5" month="10" year="1999" /> 1434f5e4d26dSAaron Stone <abstract> 1435f5e4d26dSAaron Stone <t>http://www.livejournal.com/</t> 1436f5e4d26dSAaron Stone </abstract> 1437f5e4d26dSAaron Stone </front> 1438f5e4d26dSAaron Stone </reference> 1439618d23a4SSteve Wills <dwdrfc-ref anchor="KEYWORDS" src='reference.RFC.2119.xml'/> 1440f5e4d26dSAaron Stone </references> 1441f5e4d26dSAaron Stone 1442f5e4d26dSAaron Stone <section anchor="acknowledgments" title="Acknowledgments"> 1443f5e4d26dSAaron Stone <t> 1444f5e4d26dSAaron Stone Thanks to Brad Fitzpatrick, Anatoly Vorobey, Steven Grimm, and Dustin 1445f5e4d26dSAaron Stone Sallings, for their work on the memcached server. 1446f5e4d26dSAaron Stone </t> 1447f5e4d26dSAaron Stone 1448f5e4d26dSAaron Stone <t> 1449f5e4d26dSAaron Stone Thanks to Sean Chittenden, Jonathan Steinert, Brian Aker, Evan Martin, 1450f5e4d26dSAaron Stone Nathan Neulinger, Eric Hodel, Michael Johnson, Paul Querna, Jamie 1451f5e4d26dSAaron Stone McCarthy, Philip Neustrom, Andrew O'Brien, Josh Rotenberg, Robin H. 1452f5e4d26dSAaron Stone Johnson, Tim Yardley, Paolo Borelli, Eli Bingham, Jean-Francois 1453f5e4d26dSAaron Stone Bustarret, Paul G, Paul Lindner, Alan Kasindorf, Chris Goffinet, Tomash 1454f5e4d26dSAaron Stone Brechko, and others for their work reporting bugs and maintaining 1455f5e4d26dSAaron Stone memcached client libraries and bindings in many languages. 1456f5e4d26dSAaron Stone </t> 1457f5e4d26dSAaron Stone </section> 1458f5e4d26dSAaron Stone </back> 1459f5e4d26dSAaron Stone 1460f5e4d26dSAaron Stone</rfc> 1461f5e4d26dSAaron Stone 1462