• r5_502253
    了解作者
  • 244.3KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-10 19:26
    上传日期
memcached
memcached-1.2.5-win32.zip
  • memcached-1.2.5-win32
  • missing
    10KB
  • items.c
    14KB
  • COPYING
    1.5KB
  • slabs.c
    12.7KB
  • compile
    2.7KB
  • aclocal.m4
    31.8KB
  • stats.h
    285B
  • t
  • daemonize.t
    738B
  • multiversioning.t
    1.5KB
  • slab-reassign.t
    211B
  • incrdecr.t
    1.5KB
  • binary-get.t
    499B
  • bogus-commands.t
    271B
  • flags.t
    456B
  • udp.t
    4.1KB
  • unixsocket.t
    503B
  • maxconns.t
    453B
  • lru.t
    211B
  • stats.t
    1.3KB
  • getset.t
    2.9KB
  • managed-buckets.t
    211B
  • flush-all.t
    1.2KB
  • noreply.t
    1.5KB
  • 00-startup.t
    369B
  • stress-memcached.pl
    2.2KB
  • cas.t
    3.4KB
  • 64bit.t
    1.1KB
  • expirations.t
    1.3KB
  • lib
  • MemcachedTest.pm
    6.3KB
  • whitespace.t
    542B
  • delete-window.t
    2.2KB
  • stats-detail.t
    2.1KB
  • INSTALL
    9.3KB
  • config.h.in
    2.3KB
  • mkinstalldirs
    1.9KB
  • slabs.h
    1.1KB
  • items.h
    963B
  • configure
    200.3KB
  • memcached.h
    14.1KB
  • ChangeLog
    16.5KB
  • assoc.h
    296B
  • install-sh
    7KB
  • Makefile.in
    34KB
  • TODO
    985B
  • depcomp
    13.5KB
  • AUTHORS
    69B
  • memcached.spec
    2.8KB
  • stats.c
    11.8KB
  • configure.ac
    5.1KB
  • scripts
  • memcached-tool
    4.7KB
  • memcached-init
    1.4KB
  • start-memcached
    2.3KB
  • memcached.sysv
    1.3KB
  • config.guess
    44.1KB
  • README
    802B
  • config.sub
    32.2KB
  • NEWS
    40B
  • doc
  • Doxyfile
    50.8KB
  • memory_management.txt
    5.2KB
  • Makefile.in
    9.6KB
  • protocol.txt
    23.5KB
  • threads.txt
    3.5KB
  • memcached.1
    4.2KB
  • CONTRIBUTORS
    1.3KB
  • Makefile
    10KB
  • binary-protocol-plan.txt
    2.2KB
  • Makefile.am
    43B
  • assoc.c
    19.6KB
  • Makefile.am
    563B
  • win32
  • memcached.rc
    1.5KB
  • ntservice.c
    9.6KB
  • config.h
    2KB
  • ntservice.h
    422B
  • win32.c
    6.1KB
  • memcached.vcproj
    5KB
  • win32.h
    3.3KB
  • memcached.sln
    1.5KB
  • bsd_getopt.c
    14.7KB
  • bsd_getopt.h
    706B
  • thread.c
    15.9KB
  • memcached.c
    97.6KB
  • daemon.c
    2.6KB
内容介绍
Protocol -------- Clients of memcached communicate with server through TCP connections. (A UDP interface is also available; details are below under "UDP protocol.") A given running memcached server listens on some (configurable) port; clients connect to that port, send commands to the server, read responses, and eventually close the connection. There is no need to send any command to end the session. A client may just close the connection at any moment it no longer needs it. Note, however, that clients are encouraged to cache their connections rather than reopen them every time they need to store or retrieve data. This is because memcached is especially designed to work very efficiently with a very large number (many hundreds, more than a thousand if necessary) of open connections. Caching connections will eliminate the overhead associated with establishing a TCP connection (the overhead of preparing for a new connection on the server side is insignificant compared to this). There are two kinds of data sent in the memcache protocol: text lines and unstructured data. Text lines are used for commands from clients and responses from servers. Unstructured data is sent when a client wants to store or retrieve data. The server will transmit back unstructured data in exactly the same way it received it, as a byte stream. The server doesn't care about byte order issues in unstructured data and isn't aware of them. There are no limitations on characters that may appear in unstructured data; however, the reader of such data (either a client or a server) will always know, from a preceding text line, the exact length of the data block being transmitted. Text lines are always terminated by \r\n. Unstructured data is _also_ terminated by \r\n, even though \r, \n or any other 8-bit characters may also appear inside the data. Therefore, when a client retrieves data from a server, it must use the length of the data block (which it will be provided with) to determine where the data block ends, and not the fact that \r\n follows the end of the data block, even though it does. Keys ---- Data stored by memcached is identified with the help of a key. A key is a text string which should uniquely identify the data for clients that are interested in storing and retrieving it. 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. Commands -------- There are three types of commands. Storage commands (there are six: "set", "add", "replace", "append" "prepend" and "cas") ask the server to store some data identified by a key. The client sends a command line, and then a data block; after that the client expects one line of response, which will indicate success or faulure. Retrieval commands (there are two: "get" and "gets") ask the server to retrieve data corresponding to a set of keys (one or more keys in one request). The client sends a command line, which includes all the requested keys; after that for each item the server finds it sends to the client one response line with information about the item, and one data block with the item's data; this continues until the server finished with the "END" response line. All other commands don't involve unstructured data. In all of them, the client sends one command line, and expects (depending on the command) either one line of response, or several lines of response ending with "END" on the last line. A command line always starts with the name of the command, followed by parameters (if any) delimited by whitespace. Command names are lower-case and are case-sensitive. Expiration times ---------------- Some commands involve a client sending some kind of expiration time (relative to an item or to an operation requested by the client) to the server. In all such cases, the actual value sent may either be Unix time (number of seconds since January 1, 1970, as a 32-bit value), or a number of seconds starting from current time. In the latter case, this number of seconds may not exceed 60*60*24*30 (number of seconds in 30 days); if the number sent by a client is larger than that, the server will consider it to be real Unix time value rather than an offset from current time. Error strings ------------- Each command sent by a client may be answered with an error string from the server. These error strings come in three types: - "ERROR\r\n" means the client sent a nonexistent command name. - "CLIENT_ERROR <error>\r\n" means some sort of client error in the input line, i.e. the input doesn't conform to the protocol in some way. <error> is a human-readable error string. - "SERVER_ERROR <error>\r\n" means some sort of server error prevents the server from carrying out the command. <error> is a human-readable error string. In cases of severe server errors, which make it impossible to continue serving the client (this shouldn't normally happen), the server will close the connection after sending the error line. This is the only case in which the server closes a connection to a client. In the descriptions of individual commands below, these error lines are not again specifically mentioned, but clients must allow for their possibility. Storage commands ---------------- First, the client sends a command line which looks like this: <command name> <key> <flags> <exptime> <bytes> [noreply]\r\n cas <key> <flags> <exptime> <bytes> <cas unqiue> [noreply]\r\n - <command name> is "set", "add", "replace", "append" or "prepend" "set" means "store this data". "add" means "store this data, but only if the server *doesn't* already hold data for this key". "replace" means "store this data, but only if the server *does* already hold data for this key". "append" means "add this data to an existing key after existing data". "prepend" means "add this data to an existing key before existing data". The append and prepend commands do not accept flags or exptime. They update existing data portions, and ignore new flag and exptime settings. "cas" is a check and set operation which means "store this data but only if no one else has updated since I last fetched it." - <key> is the key under which the client asks to store the data - <flags> is 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. - <exptime> is expiration time. If it's 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 server time). - <bytes> is 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). - <cas unique> is a unique 64-bit value of an existing entry. Clients should use the value returned from the "gets" command when issuing "cas" updates. - "noreply" optional parameter instructs the server to not send the reply. NOTE: if the request line is malformed, the server can't parse "noreply" option reliably. In this case it may send the error to the client, and not reading it on the client side will break things. Client should construct only valid requests. After this line, the client sends the data block: <data block>\r\n - <data block> is a chunk of arbitrary 8-bit data of length <bytes> from the previous line. After sending the comma
评论
    相关推荐