mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Merge branch 'MDL-80208' of https://github.com/paulholden/moodle
This commit is contained in:
commit
1790452026
2
cache/stores/redis/lib.php
vendored
2
cache/stores/redis/lib.php
vendored
@ -469,7 +469,7 @@ class cachestore_redis extends cache_store implements cache_is_key_aware, cache_
|
||||
$ttlparams[] = $key;
|
||||
}
|
||||
}
|
||||
if ($usettl) {
|
||||
if ($usettl && count($ttlparams) > 0) {
|
||||
// Store all the key values with current time.
|
||||
$this->redis->zAdd($this->hash . self::TTL_SUFFIX, [], ...$ttlparams);
|
||||
// The return value to the zAdd function never indicates whether the operation succeeded
|
||||
|
11
cache/stores/redis/tests/ttl_test.php
vendored
11
cache/stores/redis/tests/ttl_test.php
vendored
@ -29,7 +29,7 @@ namespace cachestore_redis;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \cachestore_redis
|
||||
*/
|
||||
class ttl_test extends \advanced_testcase {
|
||||
final class ttl_test extends \advanced_testcase {
|
||||
/** @var \cachestore_redis|null Cache store */
|
||||
protected $store = null;
|
||||
|
||||
@ -66,6 +66,15 @@ class ttl_test extends \advanced_testcase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test calling set_many with an empty array
|
||||
*
|
||||
* Trivial test to ensure we don't trigger an ArgumentCountError when calling zAdd with invalid parameters
|
||||
*/
|
||||
public function test_set_many_empty(): void {
|
||||
$this->assertEquals(0, $this->store->set_many([]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests expiring data.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user