From 26e7eceefc2afa283c1173cae3f205486b49053e Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Tue, 15 Mar 2016 10:57:03 +0800 Subject: [PATCH] MDL-51374 cache: add temp_tables cache definition Also a helper method get_temp_tables_cache() has been created for temporary tables cache operations. --- lang/en/cache.php | 1 + lib/db/caches.php | 6 ++++++ lib/dml/moodle_database.php | 9 +++++++++ 3 files changed, 16 insertions(+) diff --git a/lang/en/cache.php b/lang/en/cache.php index 6c34d4706c4..1d21dd09ff4 100644 --- a/lang/en/cache.php +++ b/lang/en/cache.php @@ -62,6 +62,7 @@ $string['cachedef_repositories'] = 'Repositories instances data'; $string['cachedef_search_results'] = 'Search results user data'; $string['cachedef_string'] = 'Language string cache'; $string['cachedef_tags'] = 'Tags collections and areas'; +$string['cachedef_temp_tables'] = 'Temporary tables cache'; $string['cachedef_userselections'] = 'Data used to persist user selections throughout Moodle'; $string['cachedef_yuimodules'] = 'YUI Module definitions'; $string['cachelock_file_default'] = 'Default file locking'; diff --git a/lib/db/caches.php b/lib/db/caches.php index 7f4fc16ae9f..c4cddf309e9 100644 --- a/lib/db/caches.php +++ b/lib/db/caches.php @@ -271,4 +271,10 @@ $definitions = array( 'staticaccelerationsize' => 3 ), + // Store temporary tables information. + 'temp_tables' => array( + 'mode' => cache_store::MODE_REQUEST, + 'simplekeys' => true + ), + ); diff --git a/lib/dml/moodle_database.php b/lib/dml/moodle_database.php index 1573ef51d38..3574041e723 100644 --- a/lib/dml/moodle_database.php +++ b/lib/dml/moodle_database.php @@ -336,6 +336,15 @@ abstract class moodle_database { return cache::make('core', 'databasemeta', $properties); } + /** + * Handle the creation and caching of the temporary tables. + * + * @return cache_application The temp_tables cachestore to complete operations on. + */ + protected function get_temp_tables_cache() { + return cache::make('core', 'temp_tables'); + } + /** * Attempt to create the database * @param string $dbhost The database host.