7 public static function get($key) {
8 /*if (function_exists("apc_fetch") AND function_exists("apc_exists"))
10 return(apc_fetch($key));*/
12 $r = q("SELECT `v` FROM `cache` WHERE `k`='%s' limit 1",
17 /*if (function_exists("apc_store"))
18 apc_store($key, $r[0]['v'], 600);*/
25 public static function set($key,$value) {
27 q("REPLACE INTO `cache` (`k`,`v`,`updated`) VALUES ('%s','%s','%s')",
30 dbesc(datetime_convert()));
32 /*if (function_exists("apc_store"))
33 apc_store($key, $value, 600);*/
40 * Leaving this legacy code temporaily to see how REPLACE fares
41 * as opposed to non-atomic checks when faced with fast moving key duplication.
42 * As a MySQL extension it isn't portable, but we're not yet very portable.
46 * $r = q("SELECT * FROM `cache` WHERE `k`='%s' limit 1",
50 * q("UPDATE `cache` SET `v` = '%s', `updated = '%s' WHERE `k` = '%s'",
52 * dbesc(datetime_convert()),
56 * q("INSERT INTO `cache` (`k`,`v`,`updated`) VALUES ('%s','%s','%s')",
59 * dbesc(datetime_convert()));
65 public static function clear(){
66 q("DELETE FROM `cache` WHERE `updated` < '%s'",
67 dbesc(datetime_convert('UTC','UTC',"now - 30 days")));