Last active
December 10, 2015 18:08
-
-
Save ashikawa/4472094 to your computer and use it in GitHub Desktop.
Memcached コード補完用のスケルトン
書きかけ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @see http://php.net/manual/en/class.memcached.php | |
*/ | |
class Memcached | |
{ | |
/** | |
* Enables or disables payload compression. | |
* When enabled, item values longer than a certain threshold (currently 100 bytes) | |
* will be compressed during storage and decompressed during retrieval transparently. | |
*/ | |
const OPT_COMPRESSION = -1001; | |
/** | |
* Specifies the serializer to use for serializing non-scalar values. The valid | |
* serializers are Memcached::SERIALIZER_PHP or Memcached::SERIALIZER_IGBINARY. | |
* The latter is supported only when memcached is configured with --enable-memcached-igbinary | |
* option and the igbinary extension is loaded. | |
*/ | |
const OPT_SERIALIZER = -1003; | |
/** | |
* The default PHP serializer. | |
*/ | |
const SERIALIZER_PHP = 1; | |
/** | |
* The » igbinary serializer. Instead of textual representation it stores PHP data structures | |
* in a compact binary form, resulting in space and time gains. | |
*/ | |
const SERIALIZER_IGBINARY = 2; | |
/** | |
* The JSON serializer. Requires PHP 5.2.10+. | |
*/ | |
const SERIALIZER_JSON = 3; | |
/** | |
* This can be used to create a "domain" for your item keys. The value specified here will be | |
* prefixed to each of the keys. It cannot be longer than 128 characters and will reduce the maximum | |
* available key size. The prefix is applied only to the item keys, not to the server keys. | |
*/ | |
const OPT_PREFIX_KEY = -1002; | |
/** | |
* Specifies the hashing algorithm used for the item keys. The valid values are supplied via Memcached::HASH_* constants. | |
* Each hash algorithm has its advantages and its disadvantages. Go with the default if you don't know or don't care. | |
*/ | |
const OPT_HASH = 2; | |
/** | |
* The default (Jenkins one-at-a-time) item key hashing algorithm. | |
*/ | |
const HASH_DEFAULT = 0; | |
/** | |
* MD5 item key hashing algorithm. | |
*/ | |
const HASH_MD5 = 1; | |
/** | |
* CRC item key hashing algorithm. | |
*/ | |
const HASH_CRC = 2; | |
/** | |
* FNV1_64 item key hashing algorithm. | |
*/ | |
const HASH_FNV1_64 = 3; | |
/** | |
* FNV1_64A item key hashing algorithm. | |
*/ | |
const HASH_FNV1A_64 = 4; | |
/** | |
* FNV1_32 item key hashing algorithm. | |
*/ | |
const HASH_FNV1_32 = 5; | |
/** | |
* FNV1_32A item key hashing algorithm. | |
*/ | |
const HASH_FNV1A_32 = 6; | |
/** | |
* FNV1_32A item key hashing algorithm. | |
*/ | |
const HASH_HSIEH = 7; | |
/** | |
* Hsieh item key hashing algorithm. | |
*/ | |
const HASH_MURMUR = 8; | |
/** | |
* Murmur item key hashing algorithm. | |
*/ | |
const OPT_DISTRIBUTION = 9; | |
/** | |
* Specifies the method of distributing item keys to the servers. Currently supported methods | |
* are modulo and consistent hashing. Consistent hashing delivers better distribution and allows | |
* servers to be added to the cluster with minimal cache losses. | |
*/ | |
const DISTRIBUTION_MODULA = 0; | |
/** | |
* Modulo-based key distribution algorithm. | |
*/ | |
const DISTRIBUTION_CONSISTENT = 1; | |
/** | |
* Consistent hashing key distribution algorithm (based on libketama). | |
*/ | |
const OPT_LIBKETAMA_COMPATIBLE = 16; | |
/** | |
* Enables or disables compatibility with libketama-like behavior. When enabled, the item key | |
* hashing algorithm is set to MD5 and distribution is set to be weighted consistent hashing distribution. | |
* This is useful because other libketama-based clients (Python, Ruby, etc.) with the same server | |
* configuration will be able to access the keys transparently. | |
*/ | |
const OPT_BUFFER_WRITES = 10; | |
/** | |
* Enables or disables buffered I/O. Enabling buffered I/O causes storage commands to "buffer" instead of | |
* being sent. Any action that retrieves data causes this buffer to be sent to the remote connection. | |
* Quitting the connection or closing down the connection will also cause the buffered data to be pushed to | |
* the remote connection. | |
*/ | |
const OPT_BINARY_PROTOCOL = 18; | |
/** | |
* Enable the use of the binary protocol. Please note that you cannot toggle this option on an open connection. | |
*/ | |
const OPT_NO_BLOCK = 0; | |
/** | |
* Enables or disables asynchronous I/O. This is the fastest transport available for storage functions. | |
*/ | |
const OPT_TCP_NODELAY = 1; | |
/** | |
* The maximum socket send buffer in bytes. | |
*/ | |
const OPT_SOCKET_SEND_SIZE = 4; | |
/** | |
* The maximum socket receive buffer in bytes. | |
*/ | |
const OPT_SOCKET_RECV_SIZE = 5; | |
/** | |
* In non-blocking mode this set the value of the timeout during socket connection, in milliseconds. | |
*/ | |
const OPT_CONNECT_TIMEOUT = 14; | |
/** | |
* The amount of time, in seconds, to wait until retrying a failed connection attempt. | |
*/ | |
const OPT_RETRY_TIMEOUT = 15; | |
/** | |
* Socket sending timeout, in microseconds. In cases where you cannot use non-blocking I/O this | |
* will allow you to still have timeouts on the sending of data. | |
*/ | |
const OPT_SEND_TIMEOUT = 19; | |
/** | |
* Socket reading timeout, in microseconds. In cases where you cannot use non-blocking I/O this | |
* will allow you to still have timeouts on the reading of data. | |
*/ | |
const OPT_RECV_TIMEOUT = 20; | |
/** | |
* Timeout for connection polling, in milliseconds. | |
*/ | |
const OPT_POLL_TIMEOUT = 8; | |
/** | |
* Enables or disables caching of DNS lookups. | |
*/ | |
const OPT_CACHE_LOOKUPS = 6; | |
/** | |
* Specifies the failure limit for server connection attempts. The server will be removed after | |
* this many continuous connection failures. | |
*/ | |
const OPT_SERVER_FAILURE_LIMIT = 21; | |
/** | |
* Indicates whether igbinary serializer support is available. | |
*/ | |
const HAVE_IGBINARY = 0; | |
/** | |
* Indicates whether JSON serializer support is available. | |
*/ | |
const HAVE_JSON = 1; | |
/** | |
* A flag for Memcached::getMulti() and Memcached::getMultiByKey() to ensure that the keys are | |
* returned in the same order as they were requested in. Non-existing keys get a default value of NULL. | |
*/ | |
const GET_PRESERVE_ORDER = 1; | |
/** | |
* The operation was successful. | |
*/ | |
const RES_SUCCESS = 0; | |
/** | |
* The operation failed in some fashion. | |
*/ | |
const RES_FAILURE = 1; | |
/** | |
* DNS lookup failed. | |
*/ | |
const RES_HOST_LOOKUP_FAILURE = 2; | |
/** | |
* Failed to read network data. | |
*/ | |
const RES_UNKNOWN_READ_FAILURE = 7; | |
/** | |
* Bad command in memcached protocol. | |
*/ | |
const RES_PROTOCOL_ERROR = 8; | |
/** | |
* Error on the client side. | |
*/ | |
const RES_CLIENT_ERROR = 9; | |
/** | |
* Error on the server side. | |
*/ | |
const RES_SERVER_ERROR = 10; | |
/** | |
* Failed to write network data. | |
*/ | |
const RES_WRITE_FAILURE = 5; | |
/** | |
* Failed to do compare-and-swap: item you are trying to store has been modified since you last fetched it. | |
*/ | |
const RES_DATA_EXISTS = 12; | |
/** | |
* Item was not stored: but not because of an error. This normally means that either the condition for an | |
* "add" or a "replace" command wasn't met, or that the item is in a delete queue. | |
*/ | |
const RES_NOTSTORED = 14; | |
/** | |
* Item with this key was not found (with "get" operation or "cas" operations). | |
*/ | |
const RES_NOTFOUND = 16; | |
/** | |
* Partial network data read error. | |
*/ | |
const RES_PARTIAL_READ = 18; | |
/** | |
* Some errors occurred during multi-get. | |
*/ | |
const RES_SOME_ERRORS = 19; | |
/** | |
* Server list is empty. | |
*/ | |
const RES_NO_SERVERS = 20; | |
/** | |
* End of result set. | |
*/ | |
const RES_END = 21; | |
/** | |
* System error. | |
*/ | |
const RES_ERRNO = 26; | |
/** | |
* The operation was buffered. | |
*/ | |
const RES_BUFFERED = 32; | |
/** | |
* The operation timed out. | |
*/ | |
const RES_TIMEOUT = 31; | |
/** | |
* Bad key. | |
*/ | |
const RES_BAD_KEY_PROVIDED = 33; | |
/** | |
* Failed to create network socket. | |
*/ | |
const RES_CONNECTION_SOCKET_CREATE_FAILURE = 11; | |
/** | |
* Payload failure: could not compress/decompress or serialize/unserialize the value. | |
*/ | |
const RES_PAYLOAD_FAILURE = -1001; | |
/** | |
* Create a Memcached instance | |
* Creates a Memcached instance representing the connection to the memcache servers. | |
* | |
* @param string $persistent_id [optional] By default the Memcached instances are destroyed at the end of the request. | |
* To create an instance that persists between requests, use persistent_id to specify a unique ID for the instance. | |
* All instances created with the same persistent_id will share the same connection. | |
*/ | |
public function __construct ($persistent_id) {} | |
/** | |
* Add an item under a new key | |
* Memcached::add() is similar to Memcached::set(), but the operation fails if the key already exists on the server. | |
* | |
* @param string $key The key under which to store the value. | |
* @param mixed $value The value to store. | |
* @param int $expiration [optional] The expiration time, defaults to 0. See Expiration Times for more info. | |
* @return bool Returns TRUE on success or FALSE on failure. The Memcached::getResultCode() will return Memcached::RES_NOTSTORED if the key already exists. | |
*/ | |
public function add($key, $value, $expiration) {} | |
/** | |
* Add an item under a new key on a specific server | |
* Memcached::addByKey() is functionally equivalent to Memcached::add(), except that the free-form server_key can be | |
* used to map the key to a specific server. This is useful if you need to keep a bunch of related keys on a certain server. | |
* | |
* @param string $server_key The key identifying the server to store the value on. | |
* @param string $key The key under which to store the value. | |
* @param mixed $value The value to store. | |
* @param int $expiration [optional] The expiration time, defaults to 0. See Expiration Times for more info. | |
* @return bool Returns TRUE on success or FALSE on failure. The Memcached::getResultCode() will return Memcached::RES_NOTSTORED if the key already exists. | |
*/ | |
public function addByKey($server_key, $key, $value, $expiration) {} | |
/** | |
* Add a server to the server pool | |
* Memcached::addServer() adds the specified server to the server pool. No connection is established to the server at | |
* this time, but if you are using consistent key distribution option (via Memcached::DISTRIBUTION_CONSISTENT or | |
* Memcached::OPT_LIBKETAMA_COMPATIBLE), some of the internal data structures will have to be updated. Thus, if you need | |
* to add multiple servers, it is better to use Memcached::addServers() as the update then happens only once. | |
* The same server may appear multiple times in the server pool, because no duplication checks are made. | |
* This is not advisable; instead, use the weight option to increase the selection weighting of this server. | |
* | |
* @param string $host The hostname of the memcache server. If the hostname is invalid, data-related operations will set | |
* Memcached::RES_HOST_LOOKUP_FAILURE result code. | |
* @param int $port The port on which memcache is running. Usually, this is 11211. | |
* @param int $weight [optional] he weight of the server relative to the total weight of all the servers in the pool. | |
* This controls the probability of the server being selected for operations. This is used only with consistent distribution | |
* option and usually corresponds to the amount of memory available to memcache on that server. | |
* @return bool Returns TRUE on success or FALSE on failure. | |
*/ | |
public function addServer($host, $port, $weight = 0) {} | |
/** | |
* Add multiple servers to the server pool | |
* Memcached::addServers() adds servers to the server pool. Each entry in servers is supposed to be an array containing | |
* hostname, port, and, optionally, weight of the server. No connection is established to the servers at this time. | |
* The same server may appear multiple times in the server pool, because no duplication checks are made. This is not | |
* advisable; instead, use the weight option to increase the selection weighting of this server. | |
* | |
* @param array $servers Array of the servers to add to the pool. | |
* @return bool Returns TRUE on success or FALSE on failure. | |
*/ | |
public function addServers($servers) {} | |
/** | |
* Append data to an existing item | |
* Memcached::append() appends the given value string to the value of an existing item. The reason that value is forced | |
* to be a string is that appending mixed types is not well-defined. | |
* | |
* @param string $key The key under which to store the value. | |
* @param string $value The string to append. | |
* @return bool Returns TRUE on success or FALSE on failure. The Memcached::getResultCode() will return Memcached::RES_NOTSTORED if the key does not exist. | |
*/ | |
public function append($key, $value) {} | |
/** | |
* Append data to an existing item on a specific server | |
* Memcached::appendByKey() is functionally equivalent to Memcached::append(), except that the free-form server_key can be used to map the key to a specific server. | |
* | |
* @param string $server_key The key identifying the server to store the value on. | |
* @param string $key The key under which to store the value. | |
* @param string $value The string to append. | |
* @return bool Returns TRUE on success or FALSE on failure. The Memcached::getResultCode() will return Memcached::RES_NOTSTORED if the key does not exist. | |
*/ | |
public function appendByKey($server_key, $key, $value) {} | |
/** | |
* Compare and swap an item | |
* Memcached::cas() performs a "check and set" operation, so that the item will be stored only if no other client has | |
* updated it since it was last fetched by this client. The check is done via the cas_token parameter which is a unique | |
* 64-bit value assigned to the existing item by memcache. See the documentation for Memcached::get*() methods for how to | |
* obtain this token. Note that the token is represented as a double due to the limitations of PHP's integer space. | |
* | |
* @param float $cas_token Unique value associated with the existing item. Generated by memcache. | |
* @param string $key The key under which to store the value. | |
* @param mixed $value The value to store. | |
* @param int $expiration [optional] The expiration time, defaults to 0. See Expiration Times for more info. | |
* @return bool Returns TRUE on success or FALSE on failure. The Memcached::getResultCode() will return Memcached::RES_DATA_EXISTS if the item you are trying to store has been modified since you last fetched it. | |
*/ | |
public function cas($cas_token, $key, $value, $expiration) {} | |
/** | |
* Compare and swap an item on a specific server | |
* Memcached::casByKey() is functionally equivalent to Memcached::cas(), except that the free-form server_key can be used | |
* to map the key to a specific server. This is useful if you need to keep a bunch of related keys on a certain server. | |
* | |
* @param float $cas_token Unique value associated with the existing item. Generated by memcache. | |
* @param string $server_key The key identifying the server to store the value on. | |
* @param string $key The key under which to store the value. | |
* @param mixed $value The value to store. | |
* @param int $expiration [optional] The expiration time, defaults to 0. See Expiration Times for more info. | |
* @return bool Returns TRUE on success or FALSE on failure. The Memcached::getResultCode() will return Memcached::RES_DATA_EXISTS if the item you are trying to store has been modified since you last fetched it. | |
*/ | |
public function casByKey($cas_token, $server_key, $key, $value, $expiration) {} | |
/** | |
* @param string $key | |
* @param int $offset [optional] | |
* @return int | |
*/ | |
public function decrement($key, $offset=1) {} | |
/** | |
* @param string $key | |
* @param int $time [optional] | |
* @return bool | |
*/ | |
public function delete( string $key, int $time = 0) {} | |
/** | |
* @param string $server_key | |
* @param string $key | |
* @param int $time [optional] | |
* @return bool | |
*/ | |
public function deleteByKey($server_key, $key, $time=0) {} | |
/** | |
* @return array | |
*/ | |
public function fetch() {} | |
/** | |
* @return array | |
*/ | |
public function fetchAll() {} | |
/** | |
* @param int $delay [optional] | |
* @return bool | |
*/ | |
public function flush($delay=0) {} | |
/** | |
* @param string $key | |
* @param callcable $cache_cb [optional] | |
* @param float $cas_token [optional] | |
* @return mixed | |
*/ | |
public function get($key, $cache_cb, &$cas_token) {} | |
/** | |
* @param string $server_key | |
* @param string $key | |
* @param callable $cache_cb [optional] | |
* @param float $cas_token [optional] | |
* @return mixed | |
*/ | |
public function getByKey($server_key, $key, $cache_cb, &$cas_token) {} | |
/** | |
* @param array $keys | |
* @param bool $with_cas [optional] | |
* @param callbacle $value_cb [optional] | |
* @return bool | |
*/ | |
public function getDelayed($keys, $with_cas, $value_cb) {} | |
/** | |
* @param string $server_key | |
* @param array $keys | |
* @param bool $with_cas [optional] | |
* @param callable $value_cb [optional] | |
* @return bool | |
*/ | |
public function getDelayedByKey($server_key, $keys, $with_cas, $value_cb) {} | |
/** | |
* @param array $keys | |
* @param array $cas_tokens [optional] | |
* @param int $flags [optional] | |
* @return mixed | |
*/ | |
public function getMulti($keys, &$cas_tokens, $flags) {} | |
/** | |
* @param string $server_key | |
* @param array $keys | |
* @param string $cas_tokens [optional] | |
* @param int $flags [optional] | |
* @return array | |
*/ | |
public function getMultiByKey($server_key, $keys, &$cas_tokens, $flags) {} | |
/** | |
* @param int $option | |
* @return mixed | |
*/ | |
public function getOption($option) {} | |
/** | |
* @return int | |
*/ | |
public function getResultCode() {} | |
/** | |
* @return string | |
*/ | |
public function getResultMessage() {} | |
/** | |
* @param string $server_key | |
* @return array | |
*/ | |
public function getServerByKey($server_key) {} | |
/** | |
* @return array | |
*/ | |
public function getServerList() {} | |
/** | |
* @return array | |
*/ | |
public function getStats () {} | |
/** | |
* @return array | |
*/ | |
public function getVersion() {} | |
/** | |
* @param string $key | |
* @param int $offset [optional] | |
* @return int | |
*/ | |
public function increment($key, $offset=1) {} | |
/** | |
* @param string $key | |
* @param string $value | |
* @return bool | |
*/ | |
public function prepend($key, $value) {} | |
/** | |
* @param string $server_key | |
* @param string $key | |
* @param string $value | |
* @return bool | |
*/ | |
public function prependByKey($server_key, $key, $value) {} | |
/** | |
* @param string $key | |
* @param mixed $value | |
* @param int $expiration [optional] | |
* @return bool | |
*/ | |
public function replace($key, $value, $expiration) {} | |
/** | |
* @param string $server_key | |
* @param string $key | |
* @param mixed $value | |
* @param int $expiration [optional] | |
* @return bool | |
*/ | |
public function replaceByKey($server_key, $key, $value, $expiration) {} | |
/** | |
* @param string $key | |
* @param mixed $value | |
* @param int $expiration [optional] | |
* @return bool | |
*/ | |
public function set($key, $value, $expiration) {} | |
/** | |
* @param string $server_key | |
* @param string $key | |
* @param mixed $value | |
* @param int $expiration [optional] | |
* @return bool | |
*/ | |
public function setByKey($server_key, $key, $value, $expiration) {} | |
/** | |
* @param array $items | |
* @param int $expiration [optional] | |
* @return bool | |
*/ | |
public function setMulti($items, $expiration) {} | |
/** | |
* @param string $server_key | |
* @param unknown_type $items | |
* @param unknown_type $expiration | |
* @return bool | |
*/ | |
public function setMultiByKey($server_key, $items, $expiration) {} | |
/** | |
* @param int $option | |
* @param mixed $value | |
* @return bool | |
*/ | |
public function setOption($option, $value) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment