safer cache keys
This commit is contained in:
parent
ede2dc7cfe
commit
ae8d8033b9
2 changed files with 4 additions and 4 deletions
|
@ -51,7 +51,7 @@ class AutoComplete extends Extension
|
|||
}
|
||||
|
||||
# memcache keys can't contain spaces
|
||||
$cache_key = str_replace(' ', '+', "autocomplete-$search");
|
||||
$cache_key = "autocomplete:" . md5($search);
|
||||
$limitSQL = "";
|
||||
$search = str_replace('_', '\_', $search);
|
||||
$search = str_replace('%', '\%', $search);
|
||||
|
|
|
@ -555,8 +555,8 @@ class TagList extends Extension
|
|||
|
||||
|
||||
$wild_tags = $search;
|
||||
$str_search = str_replace(" ", "+", Tag::implode($search));
|
||||
$related_tags = $cache->get("related_tags:$str_search");
|
||||
$cache_key = "related_tags:" . md5(Tag::implode($search));
|
||||
$related_tags = $cache->get($cache_key);
|
||||
|
||||
if (is_null($related_tags)) {
|
||||
// $search_tags = array();
|
||||
|
@ -610,7 +610,7 @@ class TagList extends Extension
|
|||
} else {
|
||||
$related_tags = [];
|
||||
}
|
||||
$cache->set("related_tags:$str_search", $related_tags, 60 * 60);
|
||||
$cache->set($cache_key, $related_tags, 60 * 60);
|
||||
}
|
||||
return $related_tags;
|
||||
}
|
||||
|
|
Reference in a new issue