a little extra consistency in cache variable names
This commit is contained in:
parent
4721d666cd
commit
c0dfd9adc0
@ -67,7 +67,7 @@ class User {
|
||||
*/
|
||||
public static function by_session(/*string*/ $name, /*string*/ $session) {
|
||||
global $config, $database;
|
||||
$row = $database->cache->get("user-session-$name-$session");
|
||||
$row = $database->cache->get("user-session:$name-$session");
|
||||
if(!$row) {
|
||||
if($database->get_driver_name() === "mysql") {
|
||||
$query = "SELECT * FROM users WHERE name = :name AND md5(concat(pass, :ip)) = :sess";
|
||||
@ -76,7 +76,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, 600);
|
||||
$database->cache->set("user-session:$name-$session", $row, 600);
|
||||
}
|
||||
return is_null($row) ? null : new User($row);
|
||||
}
|
||||
|
@ -60,13 +60,13 @@ class Featured extends Extension {
|
||||
global $config, $database, $page, $user;
|
||||
$fid = $config->get_int("featured_id");
|
||||
if($fid > 0) {
|
||||
$image = $database->cache->get("featured_image_object-$fid");
|
||||
$image = $database->cache->get("featured_image_object:$fid");
|
||||
if($image === false) {
|
||||
$image = Image::by_id($fid);
|
||||
if($image) { // make sure the object is fully populated before saving
|
||||
$image->get_tag_array();
|
||||
}
|
||||
$database->cache->set("featured_image_object-$fid", $image, 600);
|
||||
$database->cache->set("featured_image_object:$fid", $image, 600);
|
||||
}
|
||||
if(!is_null($image)) {
|
||||
if(class_exists("Ratings")) {
|
||||
|
@ -260,10 +260,10 @@ class Index extends Extension {
|
||||
#log_debug("index", "Search for ".implode(" ", $search_terms), false, array("terms"=>$search_terms));
|
||||
$total_pages = Image::count_pages($search_terms);
|
||||
if(SPEED_HAX && $count_search_terms === 0 && ($page_number < 10)) { // extra caching for the first few post/list pages
|
||||
$images = $database->cache->get("post-list-$page_number");
|
||||
$images = $database->cache->get("post-list:$page_number");
|
||||
if(!$images) {
|
||||
$images = Image::find_images(($page_number-1)*$page_size, $page_size, $search_terms);
|
||||
$database->cache->set("post-list-$page_number", $images, 600);
|
||||
$database->cache->set("post-list:$page_number", $images, 600);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -197,7 +197,7 @@ class PrivMsg extends Extension {
|
||||
private function count_pms(User $user) {
|
||||
global $database;
|
||||
|
||||
$count = $database->cache->get("pm-count-{$user->id}");
|
||||
$count = $database->cache->get("pm-count:{$user->id}");
|
||||
if(is_null($count) || $count === false) {
|
||||
$count = $database->get_one("
|
||||
SELECT count(*)
|
||||
@ -205,7 +205,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, 600);
|
||||
$database->cache->set("pm-count:{$user->id}", $count, 600);
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user