From e3d62d907b07dbace7404fb378a97e8d38cf1e9e Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 11 Apr 2005 19:05:52 +0000 Subject: - Patch #19298 by Jeremy: loose caching! Drupal's existing caching mechanism doesn't perform well on highly dynamic websites in which the cache is flushed frequently. One example is a site that is under attack by a spambot that is posting spam comments every few seconds, causing all cached pages to be flushed every few seconds. Loose caching immediately flushes the cache only for specific users who have modified cached data (whether or not they are logged in), delaying the flushing of data for other users by several minutes. (I rewrote the help text a bit and made minor changes to the code comments.) --- database/database.mysql | 1 + database/database.pgsql | 1 + database/updates.inc | 14 +++++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) (limited to 'database') diff --git a/database/database.mysql b/database/database.mysql index b50d80cab..fbb2e76b5 100644 --- a/database/database.mysql +++ b/database/database.mysql @@ -574,6 +574,7 @@ CREATE TABLE sessions ( sid varchar(32) NOT NULL default '', hostname varchar(128) NOT NULL default '', timestamp int(11) NOT NULL default '0', + cache int(11) NOT NULL default '0', session longtext, KEY uid (uid), PRIMARY KEY (sid), diff --git a/database/database.pgsql b/database/database.pgsql index 64a63215d..a911049f0 100644 --- a/database/database.pgsql +++ b/database/database.pgsql @@ -587,6 +587,7 @@ CREATE TABLE sessions ( sid varchar(32) NOT NULL default '', hostname varchar(128) NOT NULL default '', timestamp integer NOT NULL default '0', + cache integer NOT NULL default '0', session text, PRIMARY KEY (sid) ); diff --git a/database/updates.inc b/database/updates.inc index 076d647ad..19eac2c26 100644 --- a/database/updates.inc +++ b/database/updates.inc @@ -105,7 +105,8 @@ $sql_updates = array( "2005-03-03" => "update_126", "2005-03-18" => "update_127", "2005-03-21" => "update_128", - "2005-04-08: first update since Drupal 4.6.0 release" => "update_129" + "2005-04-08: first update since Drupal 4.6.0 release" => "update_129", + "2005-04-10" => "update_130" ); function update_32() { @@ -2364,4 +2365,15 @@ function update_129() { return $ret; } +function update_130() { + $ret = array(); + if ($GLOBALS['db_type'] == 'mysql') { + $ret[] = update_sql("ALTER TABLE sessions ADD cache int(11) NOT NULL default '0' AFTER timestamp"); + } + elseif ($GLOBALS['db_type'] == 'pgsql') { + $ret[] = update_sql("ALTER TABLE sessions ADD cache int(11) NOT NULL default '0' AFTER timestamp"); + } + return $ret; +} + ?> -- cgit v1.2.3