diff options
author | Friendika <info@friendika.com> | 2011-10-24 15:49:28 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-10-24 15:49:28 -0700 |
commit | ea9d3b06f6dbe2d7bf036ea1785a1e472f6bf890 (patch) | |
tree | c6619ec376c662c381caf03fbc1e72db887bfa8d /include/cache.php | |
parent | f48fd5aa1651cdc801473e9d24c1736304533e63 (diff) | |
parent | 2905df527f2fbc9b426ebc89a53adc5c6cf1ee47 (diff) | |
download | volse-hubzilla-ea9d3b06f6dbe2d7bf036ea1785a1e472f6bf890.tar.gz volse-hubzilla-ea9d3b06f6dbe2d7bf036ea1785a1e472f6bf890.tar.bz2 volse-hubzilla-ea9d3b06f6dbe2d7bf036ea1785a1e472f6bf890.zip |
Merge pull request #35 from fabrixxm/master
Use oembed if possible without the addon
Awesome!
Diffstat (limited to 'include/cache.php')
-rw-r--r-- | include/cache.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/cache.php b/include/cache.php new file mode 100644 index 000000000..082974c61 --- /dev/null +++ b/include/cache.php @@ -0,0 +1,29 @@ +<?php + /** + * cache api + */ + + class Cache { + public static function get($key){ + $r = q("SELECT `v` FROM `cache` WHERE `k`='%s'", + dbesc($key) + ); + + if (count($r)) return $r[0]['v']; + return null; + } + + public static function set($key,$value) { + q("INSERT INTO `cache` VALUES ('%s','%s','%s')", + dbesc($key), + dbesc($value), + dbesc(datetime_convert())); + } + + public static function clear(){ + q("DELETE FROM `cache` WHERE `updated` < '%s'", + dbesc(datetime_convert('UTC','UTC',"now - 30 days"))); + } + + } + |