<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; class MemCacheUtil { private static $pool = array(); public static function remember($dwwIV, $aCnQE, $g7bU0 = 10) { goto Hfbv0; Fj_7b: $wvO30 = $aCnQE(); goto Gmvmh; Hfbv0: if (array_key_exists($dwwIV, self::$pool)) { $uTz0e = self::$pool[$dwwIV]; if ($uTz0e[0] === 0 || $uTz0e[0] < time()) { return $uTz0e[1]; } } goto Fj_7b; w0Z9z: return $wvO30; goto XNTvq; Gmvmh: self::put($dwwIV, $wvO30, $g7bU0); goto w0Z9z; XNTvq: } public static function get($dwwIV) { if (array_key_exists($dwwIV, self::$pool)) { $uTz0e = self::$pool[$dwwIV]; if ($uTz0e[0] === 0 || $uTz0e[0] < time()) { return $uTz0e[1]; } } return null; } public static function put($dwwIV, $wvO30, $g7bU0 = 0) { self::$pool[$dwwIV] = array($g7bU0 > 0 ? time() + $g7bU0 : 0, $wvO30); } public static function forget($dwwIV) { if (array_key_exists($dwwIV, self::$pool)) { unset(self::$pool[$dwwIV]); } } }