Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

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

(no description)

File Size: 275 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 2 files
 cache/stores/redis/lib.php
 cache/tests/fixtures/stores.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