示例#1
0
 /**
  * 文件缓存
  *
  * @param array $config 配置参数
  * @return \phpFastCache\Core\DriverAbstract
  */
 private function file($config = array())
 {
     $filePath = $config['filePath'];
     if (!file_exists($filePath)) {
         Filesystem::mkdir($filePath);
     }
     //初始化缓存路径
     CacheManager::setup(array("path" => isset($filePath) ? $filePath : sys_get_temp_dir()));
     CacheManager::CachingMethod("phpfastcache");
     //初始化缓存
     $InstanceCache = CacheManager::Files();
     return $InstanceCache;
 }
 public function __construct($customerKey, $environmentKey, $options = array())
 {
     $this->_customerKey = $customerKey;
     $this->_environmentKey = $environmentKey;
     $this->_auth = "{$customerKey}:{$environmentKey}";
     $this->_api = 'https://api.featureswitches.com/v1/';
     if (isset($options['api'])) {
         $this->_api = $options['api'];
     }
     $this->_cacheTimeout = 300;
     if (isset($options['cache_timeout'])) {
         $this->_cacheTimeout = $options['cache_timeout'];
     }
     CacheManager::setup(array("path" => sys_get_temp_dir()));
     CacheManager::CachingMethod("phpfastcache");
     $this->_cache = CacheManager::Files();
     $this->_httpClient = new Client(array('base_uri' => $this->_api));
 }
// rootpath is the insurgency-tools root
$rootpath = dirname($includepath);
$base_theaters = array();
// Pull in configuration settings
include "{$includepath}/config.php";
/*
	BEGIN COMMON EXECUTION CODE
	This section is run by every script, so it shouldn't do too much.
*/
// Load custom library paths for include
//parseLibPath();
use phpFastCache\CacheManager;
//require_once("phpfastcache/phpfastcache.php");
//phpFastCache::setup
CacheManager::setup(array("path" => $cachepath, "allow_search" => true));
CacheManager::CachingMethod("phpfastcache");
$cache = CacheManager::Files();
//new phpFastCache("files");
//$cache->driver_set('path',$cachepath);
//$cache->driver_set('securitykey','cache.folder');
// Connect to HLStatsX database if requested
if (isset($use_hlstatsx_db)) {
    // If HLStatsX config exists, try that first
    if (file_exists($hlstatsx_config)) {
        require $hlstatsx_config;
        mysql_connect(DB_HOST, DB_USER, DB_PASS);
        $mysql_connection = mysql_select_db(DB_NAME);
    }
    // If no database connected (either config missing or failed to connect) use fallback
    if (@(!$mysql_connection)) {
        mysql_connect($mysql_server, $mysql_username, $mysql_password);
示例#4
0
 /**
  * CacheItemPool constructor.
  *
  * @param array  $config
  * @param string $method
  */
 public function __construct(array $config, $method = 'normal')
 {
     CacheManager::setup($config);
     CacheManager::CachingMethod($method);
     $this->_cache = CacheManager::getInstance();
 }