mirror of
https://github.com/php-win-ext/phpredis.git
synced 2026-03-24 00:52:16 +01:00
Fix typos detected by codespell
This commit is contained in:
@@ -738,7 +738,7 @@ $redis->set('key','value', 10);
|
||||
// Will set the key, if it doesn't exist, with a ttl of 10 seconds
|
||||
$redis->set('key', 'value', ['nx', 'ex'=>10]);
|
||||
|
||||
// Will set a key, if it does exist, with a ttl of 1000 miliseconds
|
||||
// Will set a key, if it does exist, with a ttl of 1000 milliseconds
|
||||
$redis->set('key', 'value', ['xx', 'px'=>1000]);
|
||||
|
||||
~~~
|
||||
@@ -2679,7 +2679,7 @@ $redis->bzPopMax(string $key1, string $key2, ... int $timeout): array
|
||||
~~~
|
||||
|
||||
##### *Return value*
|
||||
*ARRAY:* Either an array with the key member and score of the higest or lowest element or an empty array if the timeout was reached without an element to pop.
|
||||
*ARRAY:* Either an array with the key member and score of the highest or lowest element or an empty array if the timeout was reached without an element to pop.
|
||||
|
||||
##### *Example*
|
||||
~~~php
|
||||
@@ -2692,7 +2692,7 @@ $redis->bzPopMax(['zs1', 'zs2'], 5);
|
||||
$redis->bzPopMax('zs1', 'zs2', 5);
|
||||
~~~
|
||||
|
||||
**Note:** Calling these functions with an array of keys or with a variable nubmer of arguments is functionally identical.
|
||||
**Note:** Calling these functions with an array of keys or with a variable number of arguments is functionally identical.
|
||||
|
||||
### zAdd
|
||||
-----
|
||||
@@ -2830,7 +2830,7 @@ $redis->zPopMax(string $key, int $count): array
|
||||
~~~
|
||||
|
||||
##### *Return value*
|
||||
*ARRAY:* Either an array with the key member and score of the higest or lowest element or an empty array if there is no element available.
|
||||
*ARRAY:* Either an array with the key member and score of the highest or lowest element or an empty array if there is no element available.
|
||||
|
||||
##### *Example*
|
||||
~~~php
|
||||
@@ -3807,7 +3807,7 @@ $obj_redis->xTrim($str_stream, $i_max_len [, $boo_approximate]);
|
||||
_**Description**_: Trim the stream length to a given maximum. If the "approximate" flag is pasesed, Redis will use your size as a hint but only trim trees in whole nodes (this is more efficient).
|
||||
|
||||
##### *Return value*
|
||||
*long*: The number of messages trimed from the stream.
|
||||
*long*: The number of messages trimmed from the stream.
|
||||
|
||||
##### *Example*
|
||||
~~~php
|
||||
|
||||
@@ -121,7 +121,7 @@ For instance, the keys “{user:1}:name” and “{user:1}:email” will be stor
|
||||
## Custom key distribution function
|
||||
In order to control the distribution of keys by hand, you can provide a custom function or closure that returns the server number, which is the index in the array of servers that you created the RedisArray object with.
|
||||
|
||||
For instance, instanciate a RedisArray object with `new RedisArray(array("us-host", "uk-host", "de-host"), array("distributor" => "dist"));` and write a function called "dist" that will return `2` for all the keys that should end up on the "de-host" server.
|
||||
For instance, instantiate a RedisArray object with `new RedisArray(array("us-host", "uk-host", "de-host"), array("distributor" => "dist"));` and write a function called "dist" that will return `2` for all the keys that should end up on the "de-host" server.
|
||||
|
||||
### Example
|
||||
<pre>
|
||||
@@ -132,7 +132,7 @@ This declares that we started with 2 shards and moved to 4 then 8 shards. The nu
|
||||
|
||||
## Migrating keys
|
||||
|
||||
When a node is added or removed from a ring, RedisArray instances must be instanciated with a “previous” list of nodes. A single call to `$ra->_rehash()` causes all the keys to be redistributed according to the new list of nodes. Passing a callback function to `_rehash()` makes it possible to track the progress of that operation: the function is called with a node name and a number of keys that will be examined, e.g. `_rehash(function ($host, $count){ ... });`.
|
||||
When a node is added or removed from a ring, RedisArray instances must be instantiated with a “previous” list of nodes. A single call to `$ra->_rehash()` causes all the keys to be redistributed according to the new list of nodes. Passing a callback function to `_rehash()` makes it possible to track the progress of that operation: the function is called with a node name and a number of keys that will be examined, e.g. `_rehash(function ($host, $count){ ... });`.
|
||||
|
||||
It is possible to automate this process, by setting `'autorehash' => TRUE` in the constructor options. This will cause keys to be migrated when they need to be read from the previous array.
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ For all of these multiple key commands (with the exception of MGET and MSET), th
|
||||
RedisCluster has specialized processing for MGET and MSET which allows you to send any number of keys (hashing to whichever slots) without having to consider where they live. The way this works, is that the RedisCluster class will split the command as it iterates through keys, delivering a subset of commands per each key's slot.
|
||||
|
||||
~~~php
|
||||
// This will be delivered in two commands. First for all of the {hash1} keys,
|
||||
// This will be delivered in two commands. First for all of the {hash1} keys,
|
||||
// and then to grab 'otherkey'
|
||||
$obj_cluster->mget(Array("{hash1}key1","{hash1}key2","{hash1}key3","otherkey"));
|
||||
~~~
|
||||
@@ -183,5 +183,5 @@ The save path for cluster based session storage takes the form of a PHP GET requ
|
||||
* _distribute_: phpredis will randomly distribute session reads between masters and any attached slaves (load balancing).
|
||||
* _failover (string)_: How phpredis should distribute session reads between master and slave nodes.
|
||||
* _none_ : phpredis will only communicate with master nodes
|
||||
* _error_: phpredis will communicate with master nodes unless one failes, in which case an attempt will be made to read session information from a slave.
|
||||
* _error_: phpredis will communicate with master nodes unless one fails, in which case an attempt will be made to read session information from a slave.
|
||||
* _auth (string, empty by default)_: The password used to authenticate with the server prior to sending commands.
|
||||
|
||||
@@ -545,7 +545,7 @@ unsigned short cluster_hash_key(const char *key, int len) {
|
||||
// Hash the whole key if we don't find a tailing } or if {} is empty
|
||||
if (e == len || e == s+1) return crc16(key, len) & REDIS_CLUSTER_MOD;
|
||||
|
||||
// Hash just the bit betweeen { and }
|
||||
// Hash just the bit between { and }
|
||||
return crc16((char*)key+s+1,e-s-1) & REDIS_CLUSTER_MOD;
|
||||
}
|
||||
|
||||
@@ -945,7 +945,7 @@ redisCachedCluster *cluster_cache_create(zend_string *hash, HashTable *nodes) {
|
||||
return cc;
|
||||
}
|
||||
|
||||
/* Takes our input hash table and returns a straigt C array with elements,
|
||||
/* Takes our input hash table and returns a straight C array with elements,
|
||||
* which have been randomized. The return value needs to be freed. */
|
||||
static zval **cluster_shuffle_seeds(HashTable *seeds, int *len) {
|
||||
zval **z_seeds, *z_ele;
|
||||
@@ -1256,7 +1256,7 @@ static int cluster_check_response(redisCluster *c, REDIS_REPLY_TYPE *reply_type
|
||||
return -1;
|
||||
}
|
||||
|
||||
// For replies that will give us a numberic length, convert it
|
||||
// For replies that will give us a numeric length, convert it
|
||||
if (*reply_type != TYPE_LINE) {
|
||||
c->reply_len = strtol(c->line_reply, NULL, 10);
|
||||
} else {
|
||||
@@ -1593,7 +1593,7 @@ PHP_REDIS_API short cluster_send_command(redisCluster *c, short slot, const char
|
||||
msstart = mstime();
|
||||
|
||||
/* Our main cluster request/reply loop. This loop runs until we're able to
|
||||
* get a valid reply from a node, hit our "request" timeout, or enounter a
|
||||
* get a valid reply from a node, hit our "request" timeout, or encounter a
|
||||
* CLUSTERDOWN state from Redis Cluster. */
|
||||
do {
|
||||
/* Send MULTI to the socket if we're in MULTI mode but haven't yet */
|
||||
@@ -2046,7 +2046,7 @@ cluster_variant_resp_generic(INTERNAL_FUNCTION_PARAMETERS, redisCluster *c,
|
||||
CLUSTER_RETURN_FALSE(c);
|
||||
}
|
||||
|
||||
// Handle ATOMIC vs. MULTI mode in a seperate switch
|
||||
// Handle ATOMIC vs. MULTI mode in a separate switch
|
||||
if (CLUSTER_IS_ATOMIC(c)) {
|
||||
switch(r->type) {
|
||||
case TYPE_INT:
|
||||
@@ -2434,7 +2434,7 @@ PHP_REDIS_API void cluster_mbulk_mget_resp(INTERNAL_FUNCTION_PARAMETERS,
|
||||
mbulk_resp_loop(c->cmd_sock, mctx->z_multi, c->reply_len, NULL) == FAILURE;
|
||||
|
||||
// If we had a failure, pad results with FALSE to indicate failure. Non
|
||||
// existant keys (e.g. for MGET will come back as NULL)
|
||||
// existent keys (e.g. for MGET will come back as NULL)
|
||||
if (fail) {
|
||||
while (mctx->count--) {
|
||||
add_next_index_bool(mctx->z_multi, 0);
|
||||
@@ -2655,7 +2655,7 @@ int mbulk_resp_loop_zipstr(RedisSock *redis_sock, zval *z_result,
|
||||
int line_len, key_len = 0;
|
||||
long long idx = 0;
|
||||
|
||||
// Our count wil need to be divisible by 2
|
||||
// Our count will need to be divisible by 2
|
||||
if (count % 2 != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@ void cluster_multi_fini(clusterMultiCmd *mc);
|
||||
unsigned short cluster_hash_key_zval(zval *key);
|
||||
unsigned short cluster_hash_key(const char *key, int len);
|
||||
|
||||
/* Get the current time in miliseconds */
|
||||
/* Get the current time in milliseconds */
|
||||
long long mstime(void);
|
||||
|
||||
PHP_REDIS_API short cluster_send_command(redisCluster *c, short slot, const char *cmd,
|
||||
|
||||
@@ -574,7 +574,7 @@ union resparg {
|
||||
};
|
||||
|
||||
/* A printf like method to construct a Redis RESP command. It has been extended
|
||||
* to take a few different format specifiers that are convienient to phpredis.
|
||||
* to take a few different format specifiers that are convenient to phpredis.
|
||||
*
|
||||
* s - C string followed by length as a
|
||||
* S - Pointer to a zend_string
|
||||
@@ -1274,7 +1274,7 @@ redis_read_stream_messages(RedisSock *redis_sock, int count, zval *z_ret
|
||||
|
||||
/* Iterate over each message */
|
||||
for (i = 0; i < count; i++) {
|
||||
/* Consume inner multi-bulk header, message ID itself and finaly
|
||||
/* Consume inner multi-bulk header, message ID itself and finally
|
||||
* the multi-bulk header for field and values */
|
||||
if ((read_mbulk_header(redis_sock, &mhdr) < 0 || mhdr != 2) ||
|
||||
((id = redis_sock_read(redis_sock, &idlen)) == NULL) ||
|
||||
|
||||
8
redis.c
8
redis.c
@@ -2347,7 +2347,7 @@ PHP_METHOD(Redis, multi)
|
||||
REDIS_ENABLE_MODE(redis_sock, PIPELINE);
|
||||
}
|
||||
} else if (multi_value == MULTI) {
|
||||
/* Don't want to do anything if we're alredy in MULTI mode */
|
||||
/* Don't want to do anything if we're already in MULTI mode */
|
||||
if (!IS_MULTI(redis_sock)) {
|
||||
cmd_len = REDIS_SPPRINTF(&cmd, "MULTI", "");
|
||||
if (IS_PIPELINE(redis_sock)) {
|
||||
@@ -2513,7 +2513,7 @@ redis_response_enqueued(RedisSock *redis_sock)
|
||||
}
|
||||
|
||||
/* TODO: Investigate/fix the odd logic going on in here. Looks like previous abort
|
||||
* condidtions that are now simply empty if { } { } blocks. */
|
||||
* conditions that are now simply empty if { } { } blocks. */
|
||||
PHP_REDIS_API int
|
||||
redis_sock_read_multibulk_multi_reply_loop(INTERNAL_FUNCTION_PARAMETERS,
|
||||
RedisSock *redis_sock, zval *z_tab,
|
||||
@@ -3042,7 +3042,7 @@ PHP_METHOD(Redis, script) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
/* Free our alocated arguments */
|
||||
/* Free our allocated arguments */
|
||||
efree(z_args);
|
||||
|
||||
// Kick off our request
|
||||
@@ -3496,7 +3496,7 @@ generic_scan_cmd(INTERNAL_FUNCTION_PARAMETERS, REDIS_SCAN_TYPE type) {
|
||||
|
||||
// The iterator should be passed in as NULL for the first iteration, but we
|
||||
// can treat any NON LONG value as NULL for these purposes as we've
|
||||
// seperated the variable anyway.
|
||||
// separated the variable anyway.
|
||||
if(Z_TYPE_P(z_iter) != IS_LONG || Z_LVAL_P(z_iter) < 0) {
|
||||
/* Convert to long */
|
||||
convert_to_long(z_iter);
|
||||
|
||||
@@ -161,7 +161,7 @@ ra_find_name(const char *name) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* laod array from INI settings */
|
||||
/* load array from INI settings */
|
||||
RedisArray *ra_load_array(const char *name) {
|
||||
|
||||
zval *z_data, z_fun, z_dist;
|
||||
|
||||
@@ -90,7 +90,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_kscan_cl, 0, 0, 2)
|
||||
ZEND_ARG_INFO(0, i_count)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
/* Argument infor for SCAN */
|
||||
/* Argument info for SCAN */
|
||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_scan_cl, 0, 0, 2)
|
||||
ZEND_ARG_INFO(1, i_iterator)
|
||||
ZEND_ARG_INFO(0, str_node)
|
||||
@@ -379,7 +379,7 @@ static void redis_cluster_init(redisCluster *c, HashTable *ht_seeds, double time
|
||||
c->read_timeout = read_timeout;
|
||||
c->persistent = persistent;
|
||||
|
||||
/* Calculate the number of miliseconds we will wait when bouncing around,
|
||||
/* Calculate the number of milliseconds we will wait when bouncing around,
|
||||
* (e.g. a node goes down), which is not the same as a standard timeout. */
|
||||
c->waitms = (long)(timeout * 1000);
|
||||
|
||||
@@ -679,7 +679,7 @@ static HashTable *method_args_to_ht(zval *z_args, int argc) {
|
||||
return ht_ret;
|
||||
}
|
||||
|
||||
/* Convienience handler for commands that take multiple keys such as
|
||||
/* Convenience handler for commands that take multiple keys such as
|
||||
* MGET, DEL, and UNLINK */
|
||||
static int cluster_mkey_cmd(INTERNAL_FUNCTION_PARAMETERS, char *kw, int kw_len,
|
||||
zval *z_ret, cluster_cb cb)
|
||||
@@ -2251,7 +2251,7 @@ cluster_cmd_get_slot(redisCluster *c, zval *z_arg)
|
||||
}
|
||||
} else {
|
||||
php_error_docref(0, E_WARNING,
|
||||
"Direted commands musty be passed a key or [host,port] array");
|
||||
"Directed commands must be passed a key or [host,port] array");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -2959,7 +2959,7 @@ PHP_METHOD(RedisCluster, ping) {
|
||||
/* Send it off */
|
||||
rtype = CLUSTER_IS_ATOMIC(c) && arg != NULL ? TYPE_BULK : TYPE_LINE;
|
||||
if (cluster_send_slot(c, slot, cmd, cmdlen, rtype) < 0) {
|
||||
CLUSTER_THROW_EXCEPTION("Unable to send commnad at the specificed node", 0);
|
||||
CLUSTER_THROW_EXCEPTION("Unable to send command at the specified node", 0);
|
||||
efree(cmd);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -3081,7 +3081,7 @@ PHP_METHOD(RedisCluster, echo) {
|
||||
/* Send it off */
|
||||
rtype = CLUSTER_IS_ATOMIC(c) ? TYPE_BULK : TYPE_LINE;
|
||||
if (cluster_send_slot(c,slot,cmd,cmd_len,rtype) < 0) {
|
||||
CLUSTER_THROW_EXCEPTION("Unable to send commnad at the specificed node", 0);
|
||||
CLUSTER_THROW_EXCEPTION("Unable to send command at the specified node", 0);
|
||||
efree(cmd);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -2176,7 +2176,7 @@ int redis_smove_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
|
||||
if (src_free) efree(src);
|
||||
if (dst_free) efree(dst);
|
||||
|
||||
// Succcess!
|
||||
// Success!
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -3867,8 +3867,8 @@ int redis_xtrim_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
|
||||
|
||||
/*
|
||||
* Redis commands that don't deal with the server at all. The RedisSock*
|
||||
* pointer is the only thing retreived differently, so we just take that
|
||||
* in additon to the standard INTERNAL_FUNCTION_PARAMETERS for arg parsing,
|
||||
* pointer is the only thing retrieved differently, so we just take that
|
||||
* in addition to the standard INTERNAL_FUNCTION_PARAMETERS for arg parsing,
|
||||
* return value handling, and thread safety. */
|
||||
|
||||
void redis_getoption_handler(INTERNAL_FUNCTION_PARAMETERS,
|
||||
@@ -4087,7 +4087,7 @@ void redis_unserialize_handler(INTERNAL_FUNCTION_PARAMETERS,
|
||||
}
|
||||
zval zv, *z_ret = &zv;
|
||||
if (!redis_unserialize(redis_sock, value, value_len, z_ret)) {
|
||||
// Badly formed input, throw an execption
|
||||
// Badly formed input, throw an exception
|
||||
zend_throw_exception(ex, "Invalid serialized data, or unserialization error", 0);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -846,7 +846,7 @@ static void session_conf_timeout(HashTable *ht_conf, const char *key, int key_le
|
||||
}
|
||||
}
|
||||
|
||||
/* Simple helper to retreive a boolean (0 or 1) value from a string stored in our
|
||||
/* Simple helper to retrieve a boolean (0 or 1) value from a string stored in our
|
||||
* session.save_path variable. This is so the user can use 0, 1, or 'true',
|
||||
* 'false' */
|
||||
static void session_conf_bool(HashTable *ht_conf, char *key, int keylen,
|
||||
|
||||
Reference in New Issue
Block a user