diff --git a/core/user.class.php b/core/user.class.php index aedfadc9..a609ebd5 100644 --- a/core/user.class.php +++ b/core/user.class.php @@ -52,7 +52,7 @@ class User { $query = "SELECT * FROM users WHERE name = :name AND md5(pass || :ip) = :sess"; } $row = $database->get_row($query, array("name"=>$name, "ip"=>get_session_ip($config), "sess"=>$session)); - $database->cache->set("user-session-$name-$session", $row, 300); + $database->cache->set("user-session-$name-$session", $row, 600); } return is_null($row) ? null : new User($row); } @@ -65,7 +65,7 @@ class User { if($cached) return new User($cached); } $row = $database->get_row("SELECT * FROM users WHERE id = :id", array("id"=>$id)); - if($id === 1) $database->cache->set('user-id:'.$id, $row, 300); + if($id === 1) $database->cache->set('user-id:'.$id, $row, 600); return is_null($row) ? null : new User($row); } diff --git a/ext/blocks/main.php b/ext/blocks/main.php index e1329234..afcda058 100644 --- a/ext/blocks/main.php +++ b/ext/blocks/main.php @@ -37,7 +37,7 @@ class Blocks extends Extension { $blocks = $database->cache->get("blocks"); if($blocks === false) { $blocks = $database->get_all("SELECT * FROM blocks"); - $database->cache->set("blocks", $blocks, 300); + $database->cache->set("blocks", $blocks, 600); } foreach($blocks as $block) { if(fnmatch($block['pages'], implode("/", $event->args))) { diff --git a/ext/featured/main.php b/ext/featured/main.php index 0ed6918d..01bf6475 100644 --- a/ext/featured/main.php +++ b/ext/featured/main.php @@ -66,7 +66,7 @@ class Featured extends Extension { if($image) { // make sure the object is fully populated before saving $image->get_tag_array(); } - $database->cache->set("featured_image_object-$fid", $image, 60); + $database->cache->set("featured_image_object-$fid", $image, 600); } if(!is_null($image)) { if(class_exists("Ratings")) { diff --git a/ext/pm/main.php b/ext/pm/main.php index 6a709afe..20935c90 100644 --- a/ext/pm/main.php +++ b/ext/pm/main.php @@ -198,7 +198,7 @@ class PrivMsg extends Extension { WHERE to_id = :to_id AND is_read = :is_read ", array("to_id" => $user->id, "is_read" => "N")); - $database->cache->set("pm-count-{$user->id}", $count, 60); + $database->cache->set("pm-count-{$user->id}", $count, 600); } return $count; } diff --git a/ext/report_image/main.php b/ext/report_image/main.php index 2f3ab3dd..20d1d6b3 100644 --- a/ext/report_image/main.php +++ b/ext/report_image/main.php @@ -72,11 +72,13 @@ class ReportImage extends Extension { "INSERT INTO image_reports(image_id, reporter_id, reason) VALUES (?, ?, ?)", array($event->image_id, $event->reporter_id, $event->reason)); + $database->cache->delete("image-report-count"); } public function onRemoveReportedImage(RemoveReportedImageEvent $event) { global $database; $database->Execute("DELETE FROM image_reports WHERE id = ?", array($event->id)); + $database->cache->delete("image-report-count"); } public function onDisplayingImage(DisplayingImageEvent $event) { @@ -99,6 +101,7 @@ class ReportImage extends Extension { public function onImageDeletion(ImageDeletionEvent $event) { global $database; $database->Execute("DELETE FROM image_reports WHERE image_id = ?", array($event->image->id)); + $database->cache->delete("image-report-count"); } protected function install() { @@ -156,7 +159,7 @@ class ReportImage extends Extension { $count = $database->cache->get("image-report-count"); if(is_null($count) || $count === false) { $count = $database->get_one("SELECT count(*) FROM image_reports"); - $database->cache->set("image-report-count", $count, 60); + $database->cache->set("image-report-count", $count, 600); } return $count;