MDL-51374 cache: add temp_tables cache definition
authorSimey Lameze <simey@moodle.com>
Tue, 15 Mar 2016 02:57:03 +0000 (10:57 +0800)
committerSimey Lameze <simey@moodle.com>
Tue, 15 Mar 2016 02:57:43 +0000 (10:57 +0800)
Also a helper method get_temp_tables_cache() has been created for temporary tables cache operations.

lang/en/cache.php
lib/db/caches.php
lib/dml/moodle_database.php

index 6c34d47..1d21dd0 100644 (file)
@@ -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';
index 7f4fc16..c4cddf3 100644 (file)
@@ -271,4 +271,10 @@ $definitions = array(
         'staticaccelerationsize' => 3
     ),
 
+    // Store temporary tables information.
+    'temp_tables' => array(
+        'mode' => cache_store::MODE_REQUEST,
+        'simplekeys' => true
+    ),
+
 );
index 1573ef5..3574041 100644 (file)
@@ -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.