]> git.mjollnir.org Git - moodle.git/commitdiff
TEXT CACHING
authormoodler <moodler>
Mon, 9 Feb 2004 12:27:34 +0000 (12:27 +0000)
committermoodler <moodler>
Mon, 9 Feb 2004 12:27:34 +0000 (12:27 +0000)
------------

I have a site which really needs this, so I went ahead with it already.

This add-on will cache formatted texts in the database and use them
for a specified timeperiod.

By default it is disabled.   Enable it with:

  $CFG->cachetext = 600;   // in seconds

config-dist.php
lib/db/mysql.php
lib/db/mysql.sql
lib/db/postgres7.php
lib/db/postgres7.sql
version.php

index 82b89934d86f8c32c446be9e5cdb2c5f334766a4..5bb790001132a2eb5706a58f707df48ab1a935f2 100644 (file)
@@ -154,6 +154,14 @@ $CFG->admin = 'admin';
 // Prevent scheduled backups from operating (and hide the GUI for them)
 // Useful for webhost operators who have alternate methods of backups
 //      $CFG->disablescheduledbackups = true;
+// 
+// On busy sites that use filters (such as the glossary autolinking) this 
+// may help - it specifies time in seconds to keep copies of formatted texts.
+//      $CFG->cachetext = 600;
+// It has some disadvantages:
+// 1) Texts will take this long to regenerate, so changes to the glossary 
+//    will not be evident immediately.
+// 2) It won't work with filters that use user settings eg: multilang
 
 
 
index 0dcdba842e665978c2245cccbc3fb4f54c950126..710672f4c867e9a4571e4ef9ae407479d69dcbd3 100644 (file)
@@ -643,6 +643,17 @@ function main_upgrade($oldversion=0) {
         table_column("course", "", "lang", "varchar", "5", "", "", "", "groupmodeforce");
     }
 
+    if ($oldversion < 2004020902) {
+        modify_database("", "CREATE TABLE `prefix_text_cache` (
+                                `id` int(10) unsigned NOT NULL auto_increment,
+                                `md5key` varchar(32) NOT NULL default '',
+                                `formattedtext` longtext NOT NULL,
+                                `timemodified` int(10) unsigned NOT NULL default '0',
+                                PRIMARY KEY  (`id`),
+                                KEY `md5key` (`md5key`)
+                             ) TYPE=MyISAM COMMENT='For storing temporary copies of processed texts';");
+    }
+
     return $result;
 
 }
index c6c8f31625d7e057679549e6839325f61caebd62..651b38c7db5954f7795ba8865da80be8560e7e79 100644 (file)
@@ -155,6 +155,23 @@ CREATE TABLE `prefix_event` (
   KEY `courseid` (`courseid`),
   KEY `userid` (`userid`)
 ) TYPE=MyISAM COMMENT='For everything with a time associated to it';
+# --------------------------------------------------------
+
+#
+# Table structure for table `text_cache`
+#
+
+CREATE TABLE `prefix_text_cache` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  `md5key` varchar(32) NOT NULL default '',
+  `formattedtext` longtext NOT NULL,
+  `timemodified` int(10) unsigned NOT NULL default '0',
+  PRIMARY KEY  (`id`),
+  KEY `md5key` (`md5key`)
+) TYPE=MyISAM COMMENT='For storing temporary copies of processed texts';
+# --------------------------------------------------------
+
+
 
 #
 # Table structure for table `group`
index ca4e8ef14ba188bbe1cb6f4e96d0edfe00869a83..173fa09a5b074dfe929704221d1c9b4fb0c85964 100644 (file)
@@ -389,6 +389,15 @@ function main_upgrade($oldversion=0) {
         table_column("course", "", "lang", "varchar", "5", "", "", "", "groupmodeforce");
     }
 
+    if ($oldversion < 2004020902) {
+        modify_database("", "CREATE TABLE prefix_text_cache (
+                                id SERIAL PRIMARY KEY,
+                                md5key varchar(32) NOT NULL default '',
+                                formattedtext text,
+                                timemodified integer NOT NULL default '0'
+                             );");
+    }
+
     return $result;
 
 }
index 99692a9c672c6ec781be1749ccaa444e250f3d05..1a57c320db04a3db76f2a1a0c414caa5d9dfbe84 100644 (file)
@@ -165,6 +165,13 @@ CREATE TABLE prefix_scale (
    timemodified integer NOT NULL default '0'
 );
 
+CREATE TABLE prefix_text_cache (
+   id SERIAL PRIMARY KEY,
+   md5key varchar(32) NOT NULL default '',
+   formattedtext text,
+   timemodified integer NOT NULL default '0'
+);
+
 CREATE TABLE prefix_user (
    id SERIAL PRIMARY KEY,
    confirmed integer NOT NULL default '0',
index fff4621716b78a561c055a2e9bc566a62c1d886a..1637f4c9e3bf4fa47d06ace0ad9e1a027f77fe2f 100644 (file)
@@ -5,7 +5,7 @@
 // database to determine whether upgrades should
 // be performed (see lib/db/*.php)
 
-$version = 2004020900;   // The current version is a date (YYYYMMDDXX)
+$version = 2004020902;   // The current version is a date (YYYYMMDDXX)
 
 $release = "1.2 development";   // User-friendly version number