From cd86859f082855b88aa775f48585a42c2638b970 Mon Sep 17 00:00:00 2001 From: Shish Date: Wed, 23 Mar 2011 11:26:11 +0000 Subject: [PATCH] cache anon, it gets looked up a lot --- core/user.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/user.class.php b/core/user.class.php index 27b792a9..7352122b 100644 --- a/core/user.class.php +++ b/core/user.class.php @@ -53,7 +53,12 @@ class User { public static function by_id($id) { assert(is_numeric($id)); global $database; + if($id == 1) { + $cached = $database->cache->get("user-id:$id"); + 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); return is_null($row) ? null : new User($row); }