Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 311 and 401] [Versions 400 and 401]

(no description)

File Size: 275 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 2 files
 cache/tests/fixtures/stores.php
 cache/stores/redis/lib.php

Defines 1 class


Class: store_test  - X-Ref

Redis cache test.

If you wish to use these unit tests all you need to do is add the following definition to
your config.php file.

define('TEST_CACHESTORE_REDIS_TESTSERVERS', '127.0.0.1');

get_class_name()   X-Ref
Returns the MongoDB class name

return: string

setUp()   X-Ref
No description

tearDown()   X-Ref
No description

create_cachestore_redis(array $extraconfig = [], bool $ttl = false)   X-Ref
Creates the required cachestore for the tests to run against Redis.

param: array $extraconfig Extra configuration options for Redis instance, if any
param: bool $ttl True to use a cache definition with TTL enabled
return: cachestore_redis

test_has()   X-Ref
No description

test_has_any()   X-Ref
No description

test_has_all()   X-Ref
No description

test_lock()   X-Ref
No description

test_lock_timeouts()   X-Ref
Checks the timeout features of locking.


test_lock_shutdown()   X-Ref
Tests the shutdown function that is supposed to free any remaining locks.


test_get_last_io_bytes()   X-Ref
Tests the get_last_io_bytes function when not using compression (just returns unknown).


test_get_last_io_bytes_compressed()   X-Ref
Tests the get_last_io_bytes byte count when using compression.


ttl_or_not()   X-Ref
Data provider for whether cache uses TTL or not.

return: array Array with true and false options

test_delete_many(bool $ttl)   X-Ref
Tests the delete_many function.

The behaviour is different with TTL enabled so we need to test with that kind of definition
as well as a 'normal' one.

param: bool $ttl True to test using a TTL definition