MDL-85336 cachestore_redis: Support floats in connection timeout

This commit is contained in:
Benjamin Walker
2025-12-08 09:06:27 +10:00
parent d58091724b
commit fcb3f1de83
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -69,6 +69,6 @@ class cachestore_redis_addinstance_form extends cachestore_addinstance_form {
$form->addElement('text', 'connectiontimeout', get_string('connectiontimeout', 'cachestore_redis'));
$form->addHelpButton('connectiontimeout', 'connectiontimeout', 'cachestore_redis');
$form->setDefault('connectiontimeout', cachestore_redis::CONNECTION_TIMEOUT);
$form->setType('connectiontimeout', PARAM_INT);
$form->setType('connectiontimeout', PARAM_FLOAT);
}
}
+4 -4
View File
@@ -68,8 +68,8 @@ class cachestore_redis extends store implements
*/
const TTL_EXPIRE_BATCH = 10000;
/** @var int The number of seconds to wait for a connection or response from the Redis server. */
const CONNECTION_TIMEOUT = 3;
/** @var float The number of seconds to wait for a connection or response from the Redis server. */
const CONNECTION_TIMEOUT = 3.0;
/**
* Name of this store.
@@ -124,7 +124,7 @@ class cachestore_redis extends store implements
/**
* The number of seconds to wait for a connection or response from the Redis server.
*
* @var int
* @var float
*/
protected $connectiontimeout = self::CONNECTION_TIMEOUT;
@@ -212,7 +212,7 @@ class cachestore_redis extends store implements
$this->compressor = (int)$configuration['compressor'];
}
if (array_key_exists('connectiontimeout', $configuration)) {
$this->connectiontimeout = (int)$configuration['connectiontimeout'];
$this->connectiontimeout = (float)$configuration['connectiontimeout'];
}
if (array_key_exists('lockwait', $configuration)) {
$this->lockwait = (int)$configuration['lockwait'];