load_filters: use memcache

master
Andrew Dolgov 15 years ago
parent 641444d3d7
commit b8ffa322a8

@ -5854,6 +5854,16 @@
function load_filters($link, $feed, $owner_uid, $action_id = false) { function load_filters($link, $feed, $owner_uid, $action_id = false) {
$filters = array(); $filters = array();
global $memcache;
if ($memcache && $obj = $memcache->get($obj_id)) {
print_r($obj);
return $obj;
} else {
if ($action_id) $ftype_query_part = "action_id = '$action_id' AND"; if ($action_id) $ftype_query_part = "action_id = '$action_id' AND";
$result = db_query($link, "SELECT reg_exp, $result = db_query($link, "SELECT reg_exp,
@ -5881,8 +5891,11 @@
array_push($filters[$line["name"]], $filter); array_push($filters[$line["name"]], $filter);
} }
if ($memcache) $memcache->add($obj_id, $filters, 0, 3600*8);
return $filters; return $filters;
} }
}
function get_score_pic($score) { function get_score_pic($score) {
if ($score > 100) { if ($score > 100) {

@ -167,6 +167,10 @@
if ($subop == "editSave") { if ($subop == "editSave") {
global $memcache;
if ($memcache) $memcache->flush();
$reg_exp = db_escape_string(trim($_REQUEST["reg_exp"])); $reg_exp = db_escape_string(trim($_REQUEST["reg_exp"]));
$filter_type = db_escape_string(trim($_REQUEST["filter_type"])); $filter_type = db_escape_string(trim($_REQUEST["filter_type"]));
$filter_id = db_escape_string($_REQUEST["id"]); $filter_id = db_escape_string($_REQUEST["id"]);

Loading…
Cancel
Save