38 Commits

Author SHA1 Message Date
sam marshall
0f8577784d MDL-78467 core_cache: Improve cache locking API
* Makes it possible to safely call acquire_lock so that it throws an
  exception instead of returning false if it can't get a lock (which
  most existing uses assumed it already does).
* Fix some omissions from the requirelockingbeforewrite option (it
  now checks on delete).
* Modinfo uses a versioned cache, so it is not necessary to delete
  items, only increase the version. (Provided we keep track of
  cacherev carefully...)
2023-09-14 09:28:10 +01:00
sam marshall
8df2ac4e98 MDL-78109 core_cache: Remove harmful requirelockingwrite/read options
These cache options are not used in core and would cause a performance
cost without any benefit if ever used. Also they don't work properly.
2023-07-12 15:33:15 +01:00
Sara Arjona
8d050aa330 Merge branch 'MDL-69653' of https://github.com/paulholden/moodle 2023-06-14 17:49:49 +02:00
Paul Holden
c21a4aebeb
MDL-69653 cache: final removal of deprecated lock methods. 2023-06-14 16:19:57 +01:00
Andrew Nicols
5138f02dd3
MDL-78466 cache: Add new result_found helper
This helper is intended to prevent recurrences of this issue by moving
the guess-work to something well tested.
2023-06-14 11:58:12 +08:00
Ilya Tregubov
25254ceea3 Merge branch 'MDL-77163-master' of https://github.com/andrewnicols/moodle 2023-03-08 17:28:13 +08:00
Andrew Nicols
8ae5ebb507 MDL-77163 cachestore_mongodb: Remve from core 2023-02-28 22:24:04 +08:00
Andrew Nicols
7bf57d9850 MDL-77161 cachestore_memcached: Remove from core 2023-02-07 21:42:50 +08:00
Mark Johnson
045ee091da MDL-67020 Cache: Make locking work for local file caches
* Add new requirelockingbeforewrite flag for cache definitions
* Implement native locking in cachestore_file (leveraging
file_lock_factory).
2022-10-20 11:31:33 +01:00
sam marshall
8a0f706033 MDL-72837 core_cache: Add versioned cache support
Adds new set_versioned and get_versioned APIs to cache, which means you can
request a specific version from cache and it will not return an outdated
version.

This is important when using multi-layer-caches where a local cache might have
an outdated version of the cache, but the shared cache has a current version.
With this feature, the content of the cache does not have to be rebuilt, as
it will automatically retrieve it from the shared cache if necessary.
2022-02-23 16:58:38 +00:00
Eloy Lafuente (stronk7)
c11096576a Merge branch 'MDL-72619-master' of https://github.com/sammarshallou/moodle 2021-11-03 18:15:28 +01:00
sam marshall
9c29979b8b MDL-72596 core_cache: Track cache I/O size in perfdebug
For cache types which mean this information can be obtained without a
significant performance cost (i.e. just by calling strlen and not
having to serialize something that wasn't serialized already),
this change calculates the size of data read from or written to cache
in each request and includes it in the perfdebug table at bottom of
output (when that is turned on).

This supports the following cache types:

* File store
* Redis (only if caching is enabled)
2021-10-19 17:00:48 +01:00
sam marshall
1b94bb8c20 MDL-72619 core_cache: Provide admin page to view cache size estimates 2021-10-11 16:49:21 +01:00
Peter Burnett
ba9fc5ed57 MDL-41492 cache: Added ability for alternate cache config 2020-09-28 15:12:33 +10:00
Eloy Lafuente (stronk7)
9a79c34eb6 MDL-69479 upgrade: Change all 4.0 occurrences to 3.10
Under parallel development, when something is worth being commented
in upgrade.txt notes, it will be applied to all the development branches
using the "earliest" one to be released. So, if something changes
in 3.10 (and also is applied to master), the upgrade.txt notes will
show 3.10 in both branches.

Of course, if something only goes to one dev branch (say master), then the
master version will be used in the notes (4.0 in this case).
2020-08-21 23:57:17 +02:00
Mihail Geshoski
566b73fbfc MDL-67594 core_lock: Deprecate extend() 2020-07-06 13:04:33 +08:00
Mihail Geshoski
80736a93aa MDL-67594 core_lock: Deprecate extend_lock() 2020-07-06 13:03:08 +08:00
Mihail Geshoski
4b71cdcd89 MDL-67594 core_lock: Deprecate supports_recursion() 2020-07-06 13:01:16 +08:00
Brendan Heywood
9f4bb48e40 MDL-68329 cache: Improve cache performance footer info 2020-04-28 10:08:28 +10:00
Mark Nelson
de0b6d938c MDL-66428 cachestore_redis: add Zstd compression support 2019-10-07 19:03:43 +01:00
Víctor Déniz Falcón
2a944b5b41 MDL-54592 cachestore_mongodb: MongoDB cache store use new driver.
The scope of this change is limited to modifying the MongoDB cache
plugin to use the new version of the driver that accepts PHP 7.x
versions. Following the instructions in the official MongoDB
documentation, https://docs.mongodb.com/php-library/current/, the
MongoDB PHP Library was included and used.
2019-03-15 13:50:51 +00:00
Andrew Nicols
666196271f MDL-60630 cachestore: Remove memcache plugin 2018-09-12 21:07:01 +08:00
Andrew Nicols
0a197875df MDL-63101 cache: Improve accuracy of cache event invalidation 2018-08-27 14:43:42 +08: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
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
Jun Pataleta
329642b9c5 MDL-54984 cache: 3.2 final deprecations 2016-07-26 00:46:37 +08:00
Russell Smith
b2159f2d3f MDL-53208 caching: Enable dereferencing as a feature.
If the cache does all the dereferencing when it stores and loads
the objects, then the cache loaders don't need to do that work.
This is true of all caches that use something other than PHP's memory
to store their results.
2016-02-28 17:01:49 +11:00
Sam Hemelryk
7fa57e0341 MDL-39459 cache: mode included in stats output
The cache store mode is now included in the performance stats
printed at the bottom of the page.
It is represented as either [a] [s] or [r] and a title is used
to actually state the mode.
2015-02-04 09:35:21 +13: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
Sam Hemelryk
63b159d0d4 MDL-48568 cache: stores now determine testing
Cache stores are now responsible for deciding if they are suitable
for use as the primary cache store during unit and acceptance tests

Changes are as follows:
* New method: cache_store::ready_to_be_used_for_testing
* Core cache store have been updated to override this method as
  required.
* MongoDB usesafe default changed to true to match actual default
  behaviour.
2014-12-12 09:30:46 +13:00
Sam Hemelryk
45a8db7f7b MDL-45699 cache: acceptance test improvements
We now use the unit test cache config class when running
acceptance tests so that the same defines are applicable there.
2014-12-09 10:51:34 +13:00
Sam Hemelryk
83bee88119 MDL-47832 cache: removed data source aggregate functionality
Cache data source aggregate functionality was found to be broken
and unused, because of this the decision was made to remove it
rather than fix it.
As it was broken we did not follow typical deprecation methods and
instead the code was removed outright with only structure
remaining and left deprecated.
2014-11-20 11:02:56 +13:00
Sam Hemelryk
ccc22a096a MDL-43349 cache: is_ready now checks are_requirements_met by default
(Fixes the fixed forwarded static call bug reverted in a5581c7)
2014-01-07 11:47:18 +08:00
Dan Poltawski
a5581c7376 Revert "MDL-43349 cache: is_ready now checks are_requirements_met by default"
This reverts commit 2201c02d73ff2998b5019ab1173349ebbee7a5e6.
2014-01-06 14:47:12 +08:00
Sam Hemelryk
2201c02d73 MDL-43349 cache: is_ready now checks are_requirements_met by default 2014-01-02 09:55:51 +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
Sam Hemelryk
a037c943bd MDL-36363 cache: clean up pre-integration 2013-01-28 10:39:23 +13:00