7 public static function get($key){
8 $r = q("SELECT `v` FROM `cache` WHERE `k`='%s' limit 1",
12 if (count($r)) return $r[0]['v'];
16 public static function set($key,$value) {
17 $r = q("SELECT * FROM `cache` WHERE `k`='%s' limit 1",
21 q("UPDATE `cache` SET `v` = '%s', `updated = '%s' WHERE `k` = '%s' limit 1",
23 dbesc(datetime_convert()),
27 q("INSERT INTO `cache` (`k`,`v`,`updated`) VALUES ('%s','%s','%s')",
30 dbesc(datetime_convert()));
34 public static function clear(){
35 q("DELETE FROM `cache` WHERE `updated` < '%s'",
36 dbesc(datetime_convert('UTC','UTC',"now - 30 days")));