pear cache_lite小记

$cache_options = array(
            "cacheDir"  =>  CACHE_DIR,
            "hashedDirectoryLevel"  =>  3, 
            "hashedDirectoryUmask"  =>  0777,
            "lifeTime"  =>  3600*24*365,
            "memoryCachingLimit" => 20000
        ); 
$cache = new Cache_Lite($cache_options);
$key=$city_utf8.$querytype.$day;    //自己设定$key
if ($data = $cache->get($key)){
    echo "缓存命中";
    return unserialize($data);
}else{
    $data = array();
    $data="";                   //给data赋值

     $cache->save(serialize($data),$key);   
    echo "生成缓存";
}

留做参考

你可能感兴趣的:(cache,360)