本文整理汇总了PHP中phpFastCache::sys方法的典型用法代码示例。如果您正苦于以下问题:PHP phpFastCache::sys方法的具体用法?PHP phpFastCache::sys怎么用?PHP phpFastCache::sys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpFastCache
的用法示例。
在下文中一共展示了phpFastCache::sys方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: autoconfig
public static function autoconfig($name = "")
{
// self::startDebug($name,"Check Name",__LINE__,__FUNCTION__);
$cache = self::cacheMethod($name);
if ($cache != "" && $cache != self::$storage && $cache != "auto") {
return $cache;
}
// self::startDebug($cache,"Check Cache",__LINE__,__FUNCTION__);
$os = self::getOS();
// self::startDebug(self::$storage,"User Set",__LINE__,__FUNCTION__);
if (self::$storage == "" || self::$storage == "auto") {
// self::startDebug(self::$storage,"User Set Auto",__LINE__,__FUNCTION__);
if (extension_loaded('apc') && ini_get('apc.enabled') && strpos(PHP_SAPI, "CGI") === false) {
self::$sys['drivers']['apc'] = true;
self::$sys['storage'] = "memory";
self::$sys['method'] = "apc";
// self::startDebug(self::$sys,"GOT APC",__LINE__,__FUNCTION__);
} elseif (extension_loaded('xcache')) {
self::$sys['drivers']['xcache'] = true;
self::$sys['storage'] = "memory";
self::$sys['method'] = "xcache";
// self::startDebug(self::$sys,"GOT XCACHE",__LINE__,__FUNCTION__);
} else {
// fix PATH for existing
$reconfig = false;
// self::startDebug(self::getPath()."/config.".$os['unique'].".cache.ini","CHECK CONFIG FILE",__LINE__,__FUNCTION__);
if (file_exists(self::getPath() . "/config." . $os['unique'] . ".cache.ini")) {
$info = self::decode(file_get_contents(self::getPath() . "/config." . $os['unique'] . ".cache.ini"));
// self::startDebug($info,"CHECK INFO",__LINE__,__FUNCTION__);
if (!isset($info['value'])) {
$reconfig = true;
} else {
$info = $info['value'];
self::$sys = $info;
}
} else {
$info = self::systemInfo();
// self::startDebug($info,"CHECK INFO BY SYSTEM INFO",__LINE__,__FUNCTION__);
}
if (isset($info['os']['unique'])) {
if ($info['os']['unique'] != $os['unique']) {
$reconfig = true;
}
} else {
$reconfig = true;
}
if (!file_exists(self::getPath() . "/config." . $os['unique'] . ".cache.ini") || $reconfig == true) {
$info = self::systemInfo();
self::$sys = $info;
// self::startDebug($info,"Check Info",__LINE__,__FUNCTION__);
try {
$f = fopen(self::getPath() . "/config." . $os['unique'] . ".cache.ini", "w+");
fwrite($f, self::encode($info));
fclose($f);
} catch (Exception $e) {
die("Please chmod 0777 " . self::getPath() . "/config." . $os['unique'] . ".cache.ini");
}
} else {
}
}
self::$storage = self::$sys['method'];
} else {
if (in_array(self::$storage, array("files", "pdo", "mpdo"))) {
self::$sys['storage'] = "disk";
} elseif (in_array(self::$storage, array("apc", "memcache", "memcached", "wincache", "xcache"))) {
self::$sys['storage'] = "memory";
} else {
self::$sys['storage'] = "";
}
if (self::$sys['storage'] == "" || !in_array(self::$storage, self::$supported_api)) {
die("Don't have this Cache " . self::$storage . " In your System! Please double check!");
}
self::$sys['method'] = strtolower(self::$storage);
}
if (self::$sys['method'] == "files") {
$last_cleanup = self::files_get("last_cleanup_cache");
if ($last_cleanup == null) {
self::files_cleanup();
self::files_set("last_cleanup_cache", @date("U"), 3600 * self::$files_cleanup_after);
}
}
// self::startDebug(self::$sys,"Check RETURN SYS",__LINE__,__FUNCTION__);
return self::$sys['method'];
}