本文整理汇总了PHP中phpFastCache::setup方法的典型用法代码示例。如果您正苦于以下问题:PHP phpFastCache::setup方法的具体用法?PHP phpFastCache::setup怎么用?PHP phpFastCache::setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpFastCache
的用法示例。
在下文中一共展示了phpFastCache::setup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Prohibit creating an object from outside
*/
public function __construct()
{
phpFastCache::setup("storage", "files");
phpFastCache::setup("path", FRONTEND_PATH . "../" . self::PATH);
phpFastCache::setup("securityKey", "cache");
self::$cache = new phpFastCache();
}
示例2: setCache
protected function setCache(Container $di, $cacheConfig, $basePath)
{
foreach ($cacheConfig as $key => $value) {
\phpFastCache::setup($key, $value);
}
\phpFastCache::setup("path", $basePath . "/var/cache");
$di->set("cache", $di->lazyNew('phpFastCache'));
}
示例3: __construct
/**
* Constructor
*/
function __construct($prefix = 'index.php?')
{
global $base_dir, $_SERVER;
phpFastCache::setup('storage', 'files');
phpFastCache::setup('path', $base_dir);
phpFastCache::setup('securityKey', 'cache');
$this->cache = phpFastCache();
$this->id = $_SERVER['QUERY_STRING'];
if ($this->id == '') {
$this->id = 'mod=home';
}
$this->id = $this->prefix . $this->id;
}
示例4: result
public function result()
{
if ($this->on_cache == true) {
require $this->path . '/phpfastcache/phpfastcache.php';
phpFastCache::setup("storage", "auto");
phpFastCache::setup('path', $this->path . '/phpfastcache/cache/');
$cache = phpFastCache();
$this->data = $cache->get($this->key_cache);
if ($this->data == null) {
$this->data = $this->get_direct();
$cache->set($this->key_cache, $this->data, 86400);
}
} else {
$this->data = $this->get_direct();
}
return $this->data;
}
示例5: defined
require_once 'vendor/autoload.php';
defined('BASE_DIR') || define('BASE_DIR', __DIR__);
defined('APP_DIR') || define('APP_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'app');
defined('RESOURCES_DIR') || define('RESOURCES_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'resources');
defined('HTML_RESOURCES_DIR') || define('HTML_RESOURCES_DIR', RESOURCES_DIR . DIRECTORY_SEPARATOR . 'html');
defined('SERVICES_DIR') || define('SERVICES_DIR', APP_DIR . DIRECTORY_SEPARATOR . 'services');
defined('CONFIG_DIR') || define('CONFIG_DIR', APP_DIR . DIRECTORY_SEPARATOR . 'config');
use Pimple\Container;
$container = new Container();
$container['config'] = function ($c) {
$configValues = (require_once CONFIG_DIR . DIRECTORY_SEPARATOR . 'main.php');
return new App\Services\DotNotation($configValues);
};
$container['cache'] = function ($c) {
// TODO: Swap out and Use a cache which supports cache namespaces
$cacheConfig = $c['config']->get('components.cache');
phpFastCache::setup("storage", $cacheConfig['storage']);
phpFastCache::setup("path", $cacheConfig['path']);
return phpFastCache();
};
$container['weatherService'] = function ($c) {
return new App\Services\YahooWeather();
};
$container['cityWeatherParser'] = function ($c) {
return new App\Services\CityWeatherParser();
};
$container['httpClient'] = function ($c) {
return new GuzzleHttp\Client();
};
\App\Services\ServiceLocator::setContainer($container);
示例6: cache
public function cache($folder = 'design')
{
require_once ROOT . DS . 'includes' . DS . 'libraries' . DS . 'phpfastcache.php';
phpFastCache::setup("storage", "files");
phpFastCache::setup("path", ROOT . DS . 'cache');
phpFastCache::setup("securityKey", $folder);
$cache = phpFastCache();
return $cache;
}
示例7: __construct
/**
* Constructor of the class.
* setting the cache-object to its default value
*
*/
private function __construct()
{
$config = (include CORE_PATH . 'classes' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR . 'phpfastcache' . EXT);
phpFastCache::setup($config);
$this->o_cache = phpFastCache();
}
示例8: get_global_sp_state
<?php
//if(!defined('IN_TRACKER'))
// die('Hacking attempt!');
require_once "cache/phpfastcache.php";
phpFastCache::setup("bonho", "auto");
$Cache = phpFastCache();
function get_global_sp_state()
{
global $Cache;
static $global_promotion_state;
if (!$global_promotion_state) {
if (!($global_promotion_state = $Cache->get_value('global_promotion_state'))) {
$res = mysql_query("SELECT * FROM torrents_state");
$row = mysql_fetch_assoc($res);
$global_promotion_state = $row["global_sp_state"];
$Cache->cache_value('global_promotion_state', $global_promotion_state, 57226);
}
}
return $global_promotion_state;
}
// IP Validation
function validip($ip)
{
if (!ip2long($ip)) {
//IPv6
return true;
}
if (!empty($ip) && $ip == long2ip(ip2long($ip))) {
// reserved IANA IPv4 addresses
// http://www.iana.org/assignments/ipv4-address-space
示例9: dirname
<?php
include 'config.php';
require "vendor/autoload.php";
use Abraham\TwitterOAuth\TwitterOAuth;
phpFastCache::setup("path", dirname(__FILE__) . '/cache');
// Path For Files
//User Whitelist Check
if (!in_array($username, $user_whitelist)) {
echo "Clever girl... But you're not on the list. <a href='http://goo.gl/forms/0wgJeVpIaI'>Request Access</a>";
exit;
}
// Set Caching
$cache = phpFastCache();
// Try to get $content from Caching First
// product_page is "identity keyword";
$link = $cache->get($username);
if ($link == null) {
$connection = new TwitterOAuth(TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET);
$content = $connection->get(API_KIND, array("screen_name" => $username, "count" => intval(POSTS_COUNT)));
if (empty($content->errors)) {
//All is dandy
foreach ($content as $tweet_object) {
$urls = $tweet_object->entities->urls;
//Get URLS
foreach ($urls as $url) {
//$debug = $url->expanded_url;
if (strpos($url->display_url, 'periscope.tv') !== false) {
//Find periscope link
$link = $url->expanded_url;
}
示例10: cometchatMemcacheConnect
function cometchatMemcacheConnect()
{
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "cometchat_cache.php";
global $memcache;
if (MEMCACHE != 0 && MC_NAME == 'memcachier') {
$memcache = new MemcacheSASL();
$memcache->addServer(MC_SERVER, MC_PORT);
$memcache->setSaslAuthData(MC_USERNAME, MC_PASSWORD);
} elseif (MEMCACHE != 0) {
phpFastCache::setup("path", dirname(__FILE__) . DIRECTORY_SEPARATOR . 'cache');
phpFastCache::setup("storage", MC_NAME);
$memcache = phpFastCache();
}
}
示例11: mysql_select_db
$NameBD = $cmd->parametro->get("NameBD");
}
$bool = mysql_select_db($NameBD, $connect);
$q = mysql_query('select * from bsw_bi.bi_server where dbName="' . $NameBD . '"');
if (mysql_num_rows($q) == 1) {
$_SESSION['id_server'] = mysql_result($q, 0);
} else {
die($LANG_ERROR_BI);
}
} catch (Exception $e) {
print $LANG_ERROR_CONNECT . " {$database}";
}
include_once "fast/phpfastcache/phpfastcache.php";
phpFastCache::setup("storage", "auto");
if (php_uname("s") == "Darwin") {
phpFastCache::setup("path", '/private/var/tmp');
}
// Path For Files includes/work must be in 777
function readDashboardSections()
{
$q = 'select distinct dashboard
from bi_dashboard,bm_items_groups
where bi_dashboard.id_item=bm_items_groups.id_item and
bm_items_groups.groupid=' . $_SESSION['groupid'] . '
order by displayorder';
$q1 = mysql_query($q);
while ($r = mysql_fetch_array($q1, MYSQL_ASSOC)) {
$data[] = array('dashboard' => $r['dashboard']);
}
return $data;
}
示例12: init
public static function init()
{
$fastCacheConfig = array("storage" => "files", "path" => $_SERVER['DOCUMENT_ROOT'] . "/../db/cache", "securityKey" => "auto", "default_chmod" => 0777, "htaccess" => TRUE);
\phpFastCache::setup($fastCacheConfig);
self::$cache = new \phpFastCache();
}
示例13: __construct
/**
* Prohibit creating an object from outside
*/
public function __construct()
{
phpFastCache::setup("storage", "files");
self::$cache = new phpFastCache();
}
示例14: setUpPHPFastCache
function setUpPHPFastCache()
{
include_once RUDRA . "/phpfastcache/phpfastcache.php";
\phpFastCache::setup("path", "./build");
}
示例15: phpFastCache
<?php
$_SESSION['id_server'] = 100;
include_once "fast/phpfastcache/phpfastcache.php";
phpFastCache::setup("storage", "files");
phpFastCache::setup("path", "/tmp");
$cache = phpFastCache();
//$cache->clean();
$key = "100";
$obj = $cache->get($key);
if ($obj == null) {
echo "nulo";
$cache->set($key, array('clock' => 0, 'value' => 0, 'valid' => 0, 't' => ''), 60);
} else {
echo "desde cache";
var_dump($obj);
}
?>