From d1644c664d986f191b4037323b5964d78a08ce63 Mon Sep 17 00:00:00 2001 From: Roberto Luna Rojas Date: Tue, 25 Mar 2025 23:03:21 -0400 Subject: [PATCH 1/3] MD022/blanks-around-headings: Headings should be surrounded by blank lines [Expected 1; Actual: 0; Below] --- docs/content/usage.md | 70 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 docs/content/usage.md diff --git a/docs/content/usage.md b/docs/content/usage.md new file mode 100644 index 0000000000..b3a033c317 --- /dev/null +++ b/docs/content/usage.md @@ -0,0 +1,70 @@ +# Valkey PHP - Docs + +## Usage + +1. [Class Redis](#class-redis) +1. [Class RedisException](#class-redisexception) +1. [Predefined constants](#predefined-constants) + +### Class Redis +----- +_**Description**_: Creates a Redis client + +##### *Example* + +```php +$redis = new Redis(); +``` + +Starting from version 6.0.0 it's possible to specify configuration options. +This allows to connect lazily to the server without explicitly invoking `connect` command. + +##### *Example* + +```php +$redis = new Redis([ + 'host' => '127.0.0.1', + 'port' => 6379, + 'connectTimeout' => 2.5, + 'auth' => ['phpredis', 'phpredis'], + 'ssl' => ['verify_peer' => false], + 'backoff' => [ + 'algorithm' => Redis::BACKOFF_ALGORITHM_DECORRELATED_JITTER, + 'base' => 500, + 'cap' => 750, + ], +]); +``` + +##### *Parameters* + +*host*: string. can be a host, or the path to a unix domain socket. +*port*: int (default is 6379, should be -1 for unix domain socket) +*connectTimeout*: float, value in seconds (default is 0 meaning unlimited) +*retryInterval*: int, value in milliseconds (optional) +*readTimeout*: float, value in seconds (default is 0 meaning unlimited) +*persistent*: mixed, if value is string then it used as persistend id, else value casts to boolean +*auth*: mixed, authentication information +*ssl*: array, SSL context options + +### Class RedisException +----- +phpredis throws a [RedisException](#class-redisexception) object if it can't reach the Redis server. That can happen in case of connectivity issues, +if the Redis service is down, or if the redis host is overloaded. In any other problematic case that does not involve an +unreachable server (such as a key not existing, an invalid command, etc), phpredis will return `FALSE`. + +### Predefined constants +----- +_**Description**_: Available Redis Constants + +Redis data types, as returned by [type](#type) +``` +Redis::REDIS_STRING - String +Redis::REDIS_SET - Set +Redis::REDIS_LIST - List +Redis::REDIS_ZSET - Sorted set +Redis::REDIS_HASH - Hash +Redis::REDIS_NOT_FOUND - Not found / other +``` + +@TODO: OPT_SERIALIZER, AFTER, BEFORE,... \ No newline at end of file From 7458082722d5ece0200abaa98bfd37981256b744 Mon Sep 17 00:00:00 2001 From: Roberto Luna Rojas Date: Tue, 25 Mar 2025 23:04:36 -0400 Subject: [PATCH 2/3] MD001/heading-increment: Heading levels should only increment by one level at a time [Expected: h4; Actual: h5] --- docs/content/usage.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/content/usage.md b/docs/content/usage.md index b3a033c317..01c1c2827f 100644 --- a/docs/content/usage.md +++ b/docs/content/usage.md @@ -7,6 +7,7 @@ 1. [Predefined constants](#predefined-constants) ### Class Redis + ----- _**Description**_: Creates a Redis client From 45c148a54eefdd051cbbbfc85f54431e093a8721 Mon Sep 17 00:00:00 2001 From: Roberto Luna Rojas Date: Tue, 25 Mar 2025 23:07:39 -0400 Subject: [PATCH 3/3] docs/usage --- docs/content/usage.md | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/docs/content/usage.md b/docs/content/usage.md index 01c1c2827f..f93443ced5 100644 --- a/docs/content/usage.md +++ b/docs/content/usage.md @@ -9,9 +9,10 @@ ### Class Redis ----- + _**Description**_: Creates a Redis client -##### *Example* +#### *Example* ```php $redis = new Redis(); @@ -20,7 +21,7 @@ $redis = new Redis(); Starting from version 6.0.0 it's possible to specify configuration options. This allows to connect lazily to the server without explicitly invoking `connect` command. -##### *Example* +#### *Example* ```php $redis = new Redis([ @@ -37,29 +38,33 @@ $redis = new Redis([ ]); ``` -##### *Parameters* +#### *Parameters* -*host*: string. can be a host, or the path to a unix domain socket. -*port*: int (default is 6379, should be -1 for unix domain socket) -*connectTimeout*: float, value in seconds (default is 0 meaning unlimited) -*retryInterval*: int, value in milliseconds (optional) -*readTimeout*: float, value in seconds (default is 0 meaning unlimited) -*persistent*: mixed, if value is string then it used as persistend id, else value casts to boolean -*auth*: mixed, authentication information -*ssl*: array, SSL context options +_host_: string. can be a host, or the path to a unix domain socket. +_port_: int (default is 6379, should be -1 for unix domain socket) +_connectTimeout_: float, value in seconds (default is 0 meaning unlimited) +_retryInterval_: int, value in milliseconds (optional) +_readTimeout_: float, value in seconds (default is 0 meaning unlimited) +_persistent_: mixed, if value is string then it used as persistend id, else value casts to boolean +_auth_: mixed, authentication information +_ssl_: array, SSL context options ### Class RedisException + ----- -phpredis throws a [RedisException](#class-redisexception) object if it can't reach the Redis server. That can happen in case of connectivity issues, -if the Redis service is down, or if the redis host is overloaded. In any other problematic case that does not involve an + +phpredis throws a [RedisException](#class-redisexception) object if it can't reach the Redis server. That can happen in case of connectivity issues, if the Redis service is down, or if the redis host is overloaded. In any other problematic case that does not involve an unreachable server (such as a key not existing, an invalid command, etc), phpredis will return `FALSE`. ### Predefined constants + ----- + _**Description**_: Available Redis Constants Redis data types, as returned by [type](#type) -``` + +```php Redis::REDIS_STRING - String Redis::REDIS_SET - Set Redis::REDIS_LIST - List @@ -68,4 +73,4 @@ Redis::REDIS_HASH - Hash Redis::REDIS_NOT_FOUND - Not found / other ``` -@TODO: OPT_SERIALIZER, AFTER, BEFORE,... \ No newline at end of file +@TODO: OPT_SERIALIZER, AFTER, BEFORE,...