APlayer-Typecho/driver/redis.class.php
metowolf b66f1b0957 🍒 支持memcached缓存
- 支持 memcached 缓存
 - 支持缓存检测
 - 支持歌词翻译
 - 升级 Meting 1.5.2
   - 不再强制 BC Math 扩展 #44
   - 网易云音乐支持海外主机
   - 修复 OpenSSL/mcrypt 兼容
 - 修复 QQ 音乐歌单识别 #43
 - 修复一些 bug
2018-03-08 14:18:32 +08:00

35 lines
805 B
PHP

<?php
class MetingCache implements MetingCacheI
{
private $redis = null;
public function __construct($option)
{
$this->redis = new Redis();
$this->redis->connect($option['host'], $option['port']);
}
public function install()
{
}
public function set($key, $value, $expire = 86400)
{
return $this->redis->set($key, $value, $expire);
}
public function get($key)
{
return $this->redis->get($key);
}
public function flush()
{
return $this->redis->flushDb();
}
public function check()
{
$number = uniqid();
$this->set('check', $number, 60);
$cache = $this->get('check');
if ($number != $cache) {
throw new Exception('Cache Test Fall!');
}
}
}