From f8b429e963b4e9fe73f0a85a0ccb2679eca65d62 Mon Sep 17 00:00:00 2001 From: Steven Wittens Date: Wed, 15 Sep 2004 20:34:35 +0000 Subject: #10862: Smarter filter cache wiping. --- database/database.mysql | 3 ++- database/database.pgsql | 1 + database/updates.inc | 16 +++++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) (limited to 'database') diff --git a/database/database.mysql b/database/database.mysql index 45d864e7e..014b63c99 100644 --- a/database/database.mysql +++ b/database/database.mysql @@ -165,7 +165,8 @@ CREATE TABLE cache ( expire int(11) NOT NULL default '0', created int(11) NOT NULL default '0', headers text, - PRIMARY KEY (cid) + PRIMARY KEY (cid), + INDEX expire (expire) ) TYPE=MyISAM; -- diff --git a/database/database.pgsql b/database/database.pgsql index 339549516..375281dfa 100644 --- a/database/database.pgsql +++ b/database/database.pgsql @@ -168,6 +168,7 @@ CREATE TABLE cache ( headers text default '', PRIMARY KEY (cid) ); +CREATE INDEX cache_expire_idx ON cache(expire); -- -- Table structure for comments diff --git a/database/updates.inc b/database/updates.inc index 9489780dc..2435492c9 100644 --- a/database/updates.inc +++ b/database/updates.inc @@ -81,7 +81,8 @@ $sql_updates = array( "2004-08-12" => "update_102", "2004-08-17" => "update_103", "2004-08-19" => "update_104", - "2004-09-14" => "update_105" + "2004-09-14" => "update_105", + "2004-09-15" => "update_106" ); function update_32() { @@ -1798,6 +1799,19 @@ function update_105() { return $ret; } +function update_106() { + $ret = array(); + if ($GLOBALS['db_type'] == 'mysql') { + $ret[] = update_sql('ALTER TABLE {cache} ADD INDEX expire (expire)'); + } + else if ($GLOBALS['db_type'] == 'pgsql') { + // TODO: needs PGSQL equivalent. + } + + $ret[] = update_sql('DELETE FROM {cache}'); + return $ret; +} + function update_sql($sql) { $edit = $_POST["edit"]; $result = db_query($sql); -- cgit v1.2.3