vendor/piwik/device-detector/Cache/StaticCache.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
/**
* Device Detector - The Universal Device Detection library for parsing User Agents
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later
*/
namespace DeviceDetector\Cache;
/**
* Class StaticCache
*
* Simple Cache that caches in a static property
* (Speeds up multiple detections in one request)
*
* @package DeviceDetector\Cache
*/
class StaticCache implements Cache
{
/**
* Holds the static cache data
* @var array
*/
protected static $staticCache = array();
public function fetch($id)
{
return $this->contains($id) ? self::$staticCache[$id] : false;
}
public function contains($id)
{
return isset(self::$staticCache[$id]) || array_key_exists($id, self::$staticCache);
}
public function save($id, $data, $lifeTime = 0)
{
self::$staticCache[$id] = $data;
return true;
}
public function delete($id)
{
unset(self::$staticCache[$id]);
return true;
}
public function flushAll()
{
self::$staticCache = array();
return true;
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。