mirror of
https://github.com/friendica/friendica
synced 2024-12-23 12:40:17 +00:00
If APC is enabled then store config data there
This commit is contained in:
parent
e40bcbb4bc
commit
6576aae938
1 changed files with 30 additions and 0 deletions
|
@ -62,6 +62,15 @@ function get_config($family, $key, $instore = false) {
|
||||||
return $a->config[$family][$key];
|
return $a->config[$family][$key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If APC is enabled then fetch the data from there
|
||||||
|
if (function_exists("apc_fetch") AND function_exists("apc_exists"))
|
||||||
|
if (apc_exists($family."|".$key)) {
|
||||||
|
$val = apc_fetch($family."|".$key);
|
||||||
|
$a->config[$family][$key] = $val;
|
||||||
|
return $val;
|
||||||
|
}
|
||||||
|
|
||||||
$ret = q("SELECT `v` FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
|
$ret = q("SELECT `v` FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
|
||||||
dbesc($family),
|
dbesc($family),
|
||||||
dbesc($key)
|
dbesc($key)
|
||||||
|
@ -117,6 +126,10 @@ function set_config($family,$key,$value) {
|
||||||
|
|
||||||
$a->config[$family][$key] = $value;
|
$a->config[$family][$key] = $value;
|
||||||
|
|
||||||
|
// If APC is enabled then store the data there
|
||||||
|
if (function_exists("apc_store"))
|
||||||
|
apc_store($family."|".$key, $value, 600);
|
||||||
|
|
||||||
if($ret)
|
if($ret)
|
||||||
return $value;
|
return $value;
|
||||||
return $ret;
|
return $ret;
|
||||||
|
@ -164,6 +177,14 @@ function get_pconfig($uid,$family, $key, $instore = false) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If APC is enabled then fetch the data from there
|
||||||
|
if (function_exists("apc_fetch") AND function_exists("apc_exists"))
|
||||||
|
if (apc_exists($uid."|".$family."|".$key)) {
|
||||||
|
$val = apc_fetch($uid."|".$family."|".$key);
|
||||||
|
$a->config[$uid][$family][$key] = $val;
|
||||||
|
return $val;
|
||||||
|
}
|
||||||
|
|
||||||
$ret = q("SELECT `v` FROM `pconfig` WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' LIMIT 1",
|
$ret = q("SELECT `v` FROM `pconfig` WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' LIMIT 1",
|
||||||
intval($uid),
|
intval($uid),
|
||||||
dbesc($family),
|
dbesc($family),
|
||||||
|
@ -191,6 +212,10 @@ function del_config($family,$key) {
|
||||||
dbesc($family),
|
dbesc($family),
|
||||||
dbesc($key)
|
dbesc($key)
|
||||||
);
|
);
|
||||||
|
// If APC is enabled then store the data there
|
||||||
|
if (function_exists("apc_delete"))
|
||||||
|
apc_delete($family."|".$key);
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
@ -228,6 +253,11 @@ function set_pconfig($uid,$family,$key,$value) {
|
||||||
|
|
||||||
$a->config[$uid][$family][$key] = $value;
|
$a->config[$uid][$family][$key] = $value;
|
||||||
|
|
||||||
|
// If APC is enabled then store the data there
|
||||||
|
if (function_exists("apc_store"))
|
||||||
|
apc_store($uid."|".$family."|".$key, $value, 600);
|
||||||
|
|
||||||
|
|
||||||
if($ret)
|
if($ret)
|
||||||
return $value;
|
return $value;
|
||||||
return $ret;
|
return $ret;
|
||||||
|
|
Loading…
Reference in a new issue