Commit Graph

60 Commits

Author SHA1 Message Date
Andrew Nicols 0a197875df MDL-63101 cache: Improve accuracy of cache event invalidation 2018-08-27 14:43:42 +08:00
sam marshall 4998d3a5be MDL-59427 MUC: cache_helper::purge_all should reset adhoc caches 2017-06-30 11:15:30 +01:00
Skylar Kelty 761ac5a0aa MDL-58658 caching: Add static acceleration unit test for empty arrays 2017-05-11 10:56:04 +01:00
Russell Smith f3789f2fb3 MDL-45584 cache: Make identifiers part of the cache creation.
It is now safe to cache a reference to a cache and expect consistent results.

Changing identifiers altered cache results where a reference was
held to the cache. Identifiers have been set to be cached with
identifiers included so the caches are separate.

As a consequence of this it was identified that invalidation events
and identifiers don't easily work together as an event can't determine
which identifiers should be used for cache invalidation.  So invalidation
events have been made incompatible with identifiers being set.  No core
code used this combination as it's not possible to understand any expected
behaviour.

Event invalidation for application and session caches was centralised to the same
location.  The only difference was the name of the lastinvalidation variable. This
improves support and consistency of invalidation code.
2017-03-02 11:06:17 +08:00
Jonathan Champ d3a6b91aec MDL-57427 cache: Use perfdebug only when enabled 2017-01-09 10:18:13 -05:00
Rajesh Taneja 96813571b1 MDL-57147 phpunit: Check if time is greater than or equal to
Some windows only have 1/100 microtime resolution
so a lot of times it does not advance enough.
2016-11-28 09:40:21 +08:00
Russell Smith a169739d5d MDL-56273 cache: Use cache initialise always.
purge_all() and purge_by_definition() look in the configuration
for which caches are available and then creates them to purge them.
The configuration stores the values used by initialise(), not
initialise_unit_test_instance() and would therefore fail to purge
all caches if they were not purged by another means.

In the case of filestore, it's purged by unit tests, in the case
of memcache(d), it purges the whole store when a single definition
is requested.

Therefore all configuration was moved into the configuration file
during unit tests and does not have any special override codes in
the unit test infrastructure.
2016-10-30 13:42:43 +11:00
David Monllao 4b5e0c542a MDL-55604 cache: Updating comment according to code changes 2016-08-24 09:39:15 +08:00
Russell Smith 7ff43e1acf MDL-55604 cache: Fix identifier and cacheable_object
When a cachable object is store in the static cache from
the backing store, it was incorrect serialised rather than
using the wake function.  This has been resolved and tests added.

During the investigation into cacheable_object, it was discovered
that set_identifiers never removes identifiers when you call it,
so set_identifiers(array('a')) and set_identifiers(array('b')) really
resulted in array('a','b') as the identifiers rather than 'b'.

The fix for this issue depends on the set_identifiers fix and
they have been coupled together as a result.
2016-08-24 11:26:20 +10:00
Russell Smith 5007975d1e MDL-53206 caching: Ensure get_many and set_many dereference objects. 2016-02-28 17:01:49 +11:00
Matt Petro 2351ed55e8 MDL-51482 caching: Fix unnecessary updates to lastinvalidation time 2015-10-08 11:48:17 -04:00
Andrew Nicols 6270f4dbdd MDL-50949 cache: Improve cache performance tests 2015-08-10 08:04:03 +08:00
Frederic Massart 47b04bcf7f MDL-50949 cache: Tests for performance debugging of cache usage 2015-07-29 14:38:58 +08:00
David Monllao b3e6802cf8 MDL-42192 caches: Adding simpledata tests 2015-05-29 17:18:31 +08:00
Eloy Lafuente (stronk7) 093c161d46 Merge branch '45699-29' of git://github.com/samhemelryk/moodle
Conflicts:
	cache/upgrade.txt
2014-12-23 02:01:36 +01:00
Eloy Lafuente (stronk7) 57bd925603 MDL-48568 cache: make tests aware of default application store
When an alternative cache configuration is used, aka:

define('TEST_CACHE_USING_ALT_CACHE_CONFIG_PATH', true);
$CFG->altcacheconfigpath = '/tmp/xxxxx.php';

the get_expected_application_cache_store() method was not able of
retroffiting the default application store being used.

This commit just implements that functionality so, when
executing unit tests using alternative configuration, assertions
looking for that will pass without a problem.
2014-12-23 01:34:35 +01:00
Sam Hemelryk 427c41ef2d MDL-45699 cache: renamed cache_config_phpunittest
Renamed cache_config_phpunittest to cache_config_testing
2014-12-09 10:51:38 +13:00
Sam Hemelryk eefb680d8e MDL-45513 cache: implemented defines for unit testing alternative caches 2014-05-30 08:41:07 +12:00
Sam Hemelryk 79a8ea653c MDL-45513 cache: added support to unit tests for alt cache stores 2014-05-30 08:41:07 +12:00
Eric Merrill e39099ac36 MDL-45603 cache Fix the mappingsonly option to work as advertised. 2014-05-17 23:48:33 -04:00
Sam Hemelryk 7310a6637a MDL-41997 cache: added unit tests for disabled stores 2013-09-30 09:41:03 +13:00
Sam Hemelryk b51fed38f2 MDL-40903 cache: renamed loader method to reflect static accelerator 2013-09-25 09:05:18 +12:00
Sam Hemelryk d074fb091d MDL-40903 cache: renamed persistcache to staticacceleration 2013-09-25 09:05:18 +12:00
Marina Glancy d67a1a8815 MDL-40903 cache: Unittests and small fixes for persistent application cache 2013-09-25 09:04:36 +12:00
Sam Hemelryk 083fa87759 MDL-40903 cache: converted persistent into persistentdata
At the same time all cache instances were made persistent
2013-09-25 09:04:35 +12:00
Sam Hemelryk 85008bedd5 MDL-41106 cache: several fixes for the session cache.
This issue makes several fixes for the session loader and the session store.
 * maxsize argument now works for session caches.
 * fixed performance hole when interation occurs frequently.
 * fixed cache purge bug occuring when multiple caches are defined before being used.
 * improved lastaccess handling.

Big thanks to Marina who contributed the following commits:
 * Always make sure the elements in cache are sorted so we need to remove only elements in the beginning of array
 * Remove expired elements from session store to free memory
 * Minor bug fixes
2013-08-26 09:15:57 +12:00
Damyon Wiese 5ebe37fb27 Revert "MDL-41106 cache: several fixes for the session cache."
This reverts commit 89182546a0.
This reverts commit 170b05362a.
This reverts commit 2e9d5a534e.
2013-08-19 15:32:08 +08:00
Sam Hemelryk 89182546a0 MDL-41106 cache: tidied up several elements 2013-08-19 11:32:08 +12:00
Petr Škoda 8252b7c291 MDL-40901 standardise core test case class and file names
This finally allows us to type only the class name when executing individual core test cases.
2013-08-04 22:10:31 +02:00
Damyon Wiese 05b659b252 MDL-40727 Cache: Fix file cache store on windows. 2013-07-24 17:04:44 +08:00
Eloy Lafuente (stronk7) 3f0a8871d3 Merge branch 'MDL-40555-master' of git://github.com/FMCorz/moodle
Conflicts:
	cache/stores/static/lib.php
2013-07-16 09:57:34 +02:00
Sam Hemelryk 4a749e93b4 MDL-40555 cache: implemented unit tests for default search functionality 2013-07-16 08:29:17 +08:00
Russell Smith ae21341523 MDL-40538 caching: Use isset for performance
isset is much faster than array_key_exists. For caches we need to
ensure as much performance as possible. To all null to continue to
be stored and provide correct results, non ttl also now saves in
$this->store[$key][0].  As isset($this->store[$key]) will return
true in all cases.

time() as found in cache::now() can be slow on some platforms and
we shouldn't bother checking it unless needed. It also stops non-ttl
caches paying the ttl price.

Unit tests were adjusted to ensure null is still handled correctly
when we are only using isset.
2013-07-10 10:15:19 +10:00
Sam Hemelryk 045fe95c63 MDL-39525 cache: fixed purging definitions requiring identifiers 2013-05-07 15:11:33 +12:00
Sam Hemelryk 5f5776c1e6 MDL-37500 cache: integration review touchups.
Issues:
1. Fix setType calls
2. Changing from default to all and editing again, default is still selected.
3. Uncheck all options causes error.
4. Doesn't seem to be restricting based upon option.
5. Picked all and got coding error with the database thing.
6. Bad title: https://github.com/samhemelryk/moodle/commit/wip-MDL-37500-m25#L1R157
7. Amend comments - should only be removed once 2.5 is the minimum version for an upgrade.
8. Document the defaultsharing option.

Outcomes:
1. Fixed - copy paste error.
2. Fixed - mforms was applying the default value despite a value being provided. A quirk of elements with array names.
3. Fixed - validation now requires at least one option to be selected.
4. Fixed - issue rose from definitions not being re-parsed. cache/admin.php now reparses the first time a user visits the page.
5. Fixed - better purging of definitions when working with them anonymously. Unit test added.
6. Fixed - new string added and used.
7. Fixed - comments amended.

New issue to address parsing of definitions during upgrade.
New issue to add debugging notice if definition sets only one possible sharing option and that option is user input.
2013-05-07 12:49:12 +12:00
Sam Hemelryk 5cba0c4ba3 MDL-38565 cache: tidy up pre-integration 2013-04-19 10:13:36 +12:00
Sam Hemelryk dbd2ea4e1f MDL-38565 cache: session caches now function as expected
This change is a large change to the way sessions are handled
within MUC after it was discovered that session did not function
as expected when any store other than the default session store
was being used.
As part of this change the session loader has been largely
customised in order to consolidate session data for the loader.
The unit tests have also being greatly increased to provide
better coverage for sessions.
2013-04-19 10:11:48 +12:00
Sam Hemelryk 35b2d0db5e MDL-38303 cache: fixed purging of session cache when switching users 2013-03-10 11:31:26 +13:00
Damyon Wiese be98769eab Merge branch 'wip-MDL-37903-m25' of git://github.com/samhemelryk/moodle 2013-03-05 13:12:12 +08:00
Sam Hemelryk 0323e1ab99 MDL-38165 cache: added unit tests for event purging of persistent caches 2013-03-01 11:38:02 +13:00
Sam Hemelryk 01a3333723 MDL-37903 cache: implemented cacheable_object_array 2013-03-01 10:09:06 +13:00
Eloy Lafuente (stronk7) c45593c6d8 Merge branch 'wip-MDL-38110-m25' of git://github.com/samhemelryk/moodle 2013-02-26 00:48:22 +01:00
Sam Hemelryk 0bdf592e6e MDL-38110 cache: increased ttl unit test value to avoid timing issues 2013-02-21 09:53:02 +13:00
Sam Hemelryk e0d9b7c0d4 MDL-37683 cache: siteidentifier is now included in the keys 2013-02-18 08:32:03 +13:00
Sam Hemelryk 956d3544f0 MDL-36363 cache: added unit tests for muliple loaders 2013-01-31 12:16:08 +13:00
Sam Hemelryk 94ef67cf5f MDL-36466 cache: tidy up after review 2012-11-26 08:12:00 +13:00
Sam Hemelryk 3680c61a3c MDL-36466 cache: implemented functionality to disable the bulk of the cache API 2012-11-26 08:12:00 +13:00
Sam Hemelryk 82afd05c35 MDL-36466 cache: renamed disable to disable_stores and added tests 2012-11-26 08:12:00 +13:00
Sam Hemelryk 702651c7a6 MDL-36120 cache: Tidied up post peer-review 2012-11-07 10:03:32 +13:00
Sam Hemelryk 47834bcd41 MDL-36120 cache: now uses sha1 and has an option for simple keys 2012-11-07 10:03:32 +13:00