Skip to content

Commit

Permalink
Merge pull request #1697 from TysonAndre/fix-typos
Browse files Browse the repository at this point in the history
Fix typos detected by codespell
  • Loading branch information
yatsukhnenko committed Jan 6, 2020
2 parents db44613 + f52bd8a commit 1ff7dfb
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 35 deletions.
10 changes: 5 additions & 5 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

~~~
Expand Down Expand Up @@ -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
Expand All @@ -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
-----
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions arrays.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions cluster.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
~~~
Expand Down Expand Up @@ -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.
14 changes: 7 additions & 7 deletions cluster_library.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion cluster_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions library.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) ||
Expand Down
8 changes: 4 additions & 4 deletions redis.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion redis_array_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions redis_cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions redis_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion redis_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1ff7dfb

Please sign in to comment.