set() 공개 메소드

写入缓存
public set ( string $name, mixed $value, integer $expire = null ) : boolen
$name string 缓存变量名
$value mixed 存储数据
$expire integer 有效时间(秒)
리턴 boolen
예제 #1
0
$count = intval($_GET['count']) > 0 ? intval($_GET['count']) : 10;
$qtype = intval($_GET['qtype']) > 0 ? intval($_GET['qtype']) : 0;
$memcache = new CacheMemcache();
$base = new base();
$pdo = $base->init_pdo($table['table_question']);
$base->load('question');
$base->load('qtype');
$base->load('answer');
$base->load('category');
$base->load('complain');
$q = $memcache->get('newqtype_list');
if (false !== $q) {
    $qtypeList = json_decode($q, true);
} else {
    $qtypeList = $_ENV['qtype']->GetAllQType(1, "", 0);
    $memcache->set('qtype_list', json_encode($qtypeList), 30 * 60);
    //缓存60秒
}
if (!isset($qtypeList[$qtype])) {
    $qtype = 0;
}
if ($qtype > 0) {
    $faq = unserialize($qtypeList[$qtype]['faq']);
    if ($faq['visiable'] == 0) {
        die(iconv("UTF-8", "gb2312//IGNORE", "尚未开通"));
    }
}
if ($type == "old") {
    $table_question = $base->getDbTable($table['table_question']);
    $table_complain = $base->getDbTable($table['table_complain']);
    $c = $memcache->get('ctype_ask');