mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-66546 caching: Add support to unix:// connections to redis.
This commit is contained in:
parent
e4d1369475
commit
63a7ce5108
1
cache/stores/redis/addinstanceform.php
vendored
1
cache/stores/redis/addinstanceform.php
vendored
@ -43,6 +43,7 @@ class cachestore_redis_addinstance_form extends cachestore_addinstance_form {
|
||||
$form->setType('server', PARAM_TEXT);
|
||||
$form->addHelpButton('server', 'server', 'cachestore_redis');
|
||||
$form->addRule('server', get_string('required'), 'required');
|
||||
$form->addElement('static', 'server_desc', '', get_string('server_desc', 'cachestore_redis'));
|
||||
|
||||
$form->addElement('advcheckbox', 'encryption', get_string('encrypt_connection', 'cachestore_redis'));
|
||||
$form->setType('encryption', PARAM_BOOL);
|
||||
|
@ -42,12 +42,13 @@ $string['privacy:metadata:redis:data'] = 'The various data stored in the cache';
|
||||
$string['serializer_igbinary'] = 'The igbinary serializer.';
|
||||
$string['serializer_php'] = 'The default PHP serializer.';
|
||||
$string['server'] = 'Server';
|
||||
$string['server_help'] = 'This sets the hostname or IP address of the Redis server to use.';
|
||||
$string['server_desc'] = 'For Unix socket usage, use the format <strong>/var/redis.sock</strong> or <strong>unix:///var/redis.sock</strong>';
|
||||
$string['server_help'] = 'This sets the hostname, IP address or Unix socket path of the Redis server to use.';
|
||||
$string['password'] = 'Password';
|
||||
$string['password_help'] = 'This sets the password of the Redis server.';
|
||||
$string['task_ttl'] = 'Free up memory used by expired entries in Redis caches';
|
||||
$string['test_server'] = 'Test server';
|
||||
$string['test_server_desc'] = 'Redis server to use for testing.';
|
||||
$string['test_server_desc'] = 'Redis server to use for testing.<br>For Unix socket usage, use the format <strong>/var/redis.sock</strong> or <strong>unix:///var/redis.sock</strong>';
|
||||
$string['test_password'] = 'Test server password';
|
||||
$string['test_password_desc'] = 'Redis test server password.';
|
||||
$string['test_serializer'] = 'Serializer';
|
||||
|
3
cache/stores/redis/lib.php
vendored
3
cache/stores/redis/lib.php
vendored
@ -217,7 +217,8 @@ class cachestore_redis extends cache_store implements cache_is_key_aware, cache_
|
||||
// Check if it isn't a Unix socket to set default port.
|
||||
$port = null;
|
||||
$opts = [];
|
||||
if ($server[0] === '/') {
|
||||
// Unix sockets can start with / or with unix://.
|
||||
if ($server[0] === '/' || strpos($server, 'unix://') === 0) {
|
||||
$port = 0;
|
||||
} else {
|
||||
$port = 6379; // No Unix socket so set default port.
|
||||
|
Loading…
x
Reference in New Issue
Block a user