Skip to content

Commit e0b000d

Browse files
committed
feat: added async & persistent options to cache predis
1 parent 858d040 commit e0b000d

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

app/Config/Cache.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,16 @@ class Cache extends BaseConfig
112112
* Your Redis server can be specified below, if you are using
113113
* the Redis or Predis drivers.
114114
*
115-
* @var array{host?: string, password?: string|null, port?: int, timeout?: int, database?: int}
115+
* @var array{host?: string, password?: string|null, port?: int, timeout?: int, async?: bool, persistent?: bool, database?: int}
116116
*/
117117
public array $redis = [
118-
'host' => '127.0.0.1',
119-
'password' => null,
120-
'port' => 6379,
121-
'timeout' => 0,
122-
'database' => 0,
118+
'host' => '127.0.0.1',
119+
'password' => null,
120+
'port' => 6379,
121+
'timeout' => 0,
122+
'async' => false,
123+
'persistent' => false,
124+
'database' => 0,
123125
];
124126

125127
/**

system/Cache/Handlers/PredisHandler.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,19 @@ class PredisHandler extends BaseHandler
3636
* host: string,
3737
* password: string|null,
3838
* port: int,
39+
* async: bool
40+
* persistent: bool
3941
* timeout: int
4042
* }
4143
*/
4244
protected $config = [
43-
'scheme' => 'tcp',
44-
'host' => '127.0.0.1',
45-
'password' => null,
46-
'port' => 6379,
47-
'timeout' => 0,
45+
'scheme' => 'tcp',
46+
'host' => '127.0.0.1',
47+
'password' => null,
48+
'port' => 6379,
49+
'async' => false,
50+
'persistent' => false,
51+
'timeout' => 0,
4852
];
4953

5054
/**

user_guide_src/source/changelogs/v4.7.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Libraries
7575

7676
- **API Transformers:** This new feature provides a structured way to transform data for API responses. See :ref:`API Transformers <api_transformers>` for details.
7777
- **CLI:** Added ``SignalTrait`` to provide unified handling of operating system signals in CLI commands.
78+
- **Cache:** Added ``async`` and ``persistent`` config item to predis handler.
7879
- **CURLRequest:** Added ``shareConnection`` config item to change default share connection.
7980
- **CURLRequest:** Added ``dns_cache_timeout`` option to change default DNS cache timeout.
8081
- **CURLRequest:** Added ``fresh_connect`` options to enable/disable request fresh connection.

0 commit comments

Comments
 (0)