Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

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

(no description)

File Size: 223 lines (8 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.

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

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_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