<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class MemCacheUtil { private static $pool = array(); public static function remember($oMJcb, $liNDm, $YZz3x = 10) { goto BlFRm; BlFRm: if (array_key_exists($oMJcb, self::$pool)) { $knQyJ = self::$pool[$oMJcb]; if ($knQyJ[0] === 0 || $knQyJ[0] < time()) { return $knQyJ[1]; } } goto HP7YY; HP7YY: $cBDsM = $liNDm(); goto GFPZr; I_d0Y: return $cBDsM; goto Web5U; GFPZr: self::put($oMJcb, $cBDsM, $YZz3x); goto I_d0Y; Web5U: } public static function get($oMJcb) { if (array_key_exists($oMJcb, self::$pool)) { $knQyJ = self::$pool[$oMJcb]; if ($knQyJ[0] === 0 || $knQyJ[0] < time()) { return $knQyJ[1]; } } return null; } public static function put($oMJcb, $cBDsM, $YZz3x = 0) { self::$pool[$oMJcb] = array($YZz3x > 0 ? time() + $YZz3x : 0, $cBDsM); } public static function forget($oMJcb) { if (array_key_exists($oMJcb, self::$pool)) { unset(self::$pool[$oMJcb]); } } }