<?php
/** 
 * UQ云商：	www.uqcms.com  
 * 联系QQ：	2200631718 
 * 可免费商用，需要留UQ云商链接作为交换，只首页底部留取即可，不影响使用。
 */
  defined('IN_UQ') or exit('Access Denied'); class cache { public static function add($uq0, $uq1, $uq2 = true) { $uq3 = self::filename($uq0); if($uq2){ $uq1 = serialize($uq1); } $uq4 = file::write_file($uq3, $uq1); if($uq4){ return true; }else{ return false; } } public static function get($uq0, $uq5 = 3600, $uq6 = true) { $uq3 = self::filename($uq0); if(file_exists($uq3) && time()-filemtime($uq3) < $uq5){ $uq1 = file::read_file($uq3); if($uq6){ $uq1 = unserialize($uq1); } return $uq1; }else{ return false; } } public static function del($uq0) { $uq3 = self::filename($uq0); return file::del_file($uq3); } public static function delall() { } public static function filename($uq0) { $uq7 = strpos($uq0, "|"); if($uq7 > 0){ $uq8 = 2; $uq9 = explode('|', $uq0); $md5 = md5($uq0); $uq0 = @$uq9[0]; for($uq11 = 0; $uq11 < $uq8; $uq11++){ $uq12 = $uq11*2; $uq13 = 2; $uq0 .= '/' . substr($md5, $uq12, $uq13); } $uq14 = 'temp/' . $uq0. '/' . substr($md5, 6, 26) .'.php'; if(!_is_dir($uq14)){ file::mk_dir($uq14, true); } return $uq14; }else{ $uq0 = 'temp/'.$uq0.'.php'; if(!_is_dir($uq0)){ file::mk_dir($uq0, true); } return $uq0; } } } 