• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP phpFastCache函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中phpFastCache函数的典型用法代码示例。如果您正苦于以下问题:PHP phpFastCache函数的具体用法?PHP phpFastCache怎么用?PHP phpFastCache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了phpFastCache函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getFeed

 /**
  * @return array
  */
 public function getFeed($params = [])
 {
     /** @var Page $page */
     $page = $this->grav['page'];
     /** @var Twig $twig */
     $twig = $this->grav['twig'];
     /** @var Data $config */
     $config = $this->mergeConfig($page, TRUE);
     // Autoload composer components
     require __DIR__ . '/vendor/autoload.php';
     // Set up cache settings
     $cache_config = array("storage" => "files", "default_chmod" => 0777, "fallback" => "files", "securityKey" => "auto", "htaccess" => true, "path" => __DIR__ . "/cache");
     // Init the cache engine
     $this->cache = phpFastCache("files", $cache_config);
     // Generate API url
     $url = 'https://api.instagram.com/v1/users/' . $config->get('feed_parameters.user_id') . '/media/recent/?access_token=' . $config->get('feed_parameters.access_token');
     // Get the cached results if available
     $results = $this->cache->get($url);
     // Get the results from the live API, cached version not found
     if ($results === null) {
         $results = Response::get($url);
         // Cache the results
         $this->cache->set($url, $results, InstagramPlugin::HOUR_IN_SECONDS * $config->get('feed_parameters.cache_time'));
         // Convert hours to seconds
     }
     $this->parseResponse($results);
     $this->template_vars = ['user_id' => $config->get('feed_parameters.user_id'), 'client_id' => $config->get('feed_parameters.client_id'), 'feed' => $this->feeds, 'count' => $config->get('feed_parameters.count')];
     $output = $this->grav['twig']->twig()->render($this->template_html, $this->template_vars);
     return $output;
 }
开发者ID:artifex404,项目名称:grav-plugin-instagram,代码行数:33,代码来源:instagram.php


示例2: __construct

 function __construct($storage = "", $config = array())
 {
     $config = array_merge(phpFastCache::$config, $config);
     $config['storage'] = $storage;
     $storage = strtolower($storage);
     if ($storage == "" || $storage == "auto") {
         $storage = self::getAutoClass($config);
     }
     $this->instance = phpFastCache($storage, $config);
 }
开发者ID:kamilklkn,项目名称:subrion,代码行数:10,代码来源:phpfastcache.php


示例3: onPluginsLoaded

 /**
  * onPluginsLoaded method
  */
 public function onPluginsLoaded()
 {
     // phpFastCache not working in CLI mode...
     if (PHILE_CLI_MODE) {
         return;
     }
     unset($this->settings['active']);
     $config = $this->settings + \phpFastCache::$config;
     $storage = $this->settings['storage'];
     $cache = phpFastCache($storage, $config);
     ServiceLocator::registerService('Phile_Cache', new PhpFastCache($cache));
 }
开发者ID:patrova,项目名称:Phile,代码行数:15,代码来源:Plugin.php


示例4: __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;
 }
开发者ID:ajisantoso,项目名称:kateglo,代码行数:16,代码来源:class_cache.php


示例5: __construct

 /**
  * Constructor
  *
  * @param array
  */
 public function __construct()
 {
     $CI =& get_instance();
     $CI->config->load('fastcache');
     //unique failsafe token for each project
     if (!file_exists(APPPATH . 'cache/fastcache_token.php')) {
         $token = md5(uniqid(mt_rand(), true));
         file_put_contents(APPPATH . 'cache/fastcache_token.php', '<?php ' . "ªn" . '$token=\'' . $token . '\';');
     } else {
         include APPPATH . 'cache/fastcache_token.php';
     }
     $this->token = $token;
     $c = $CI->config->item('fastcache');
     $this->cache = phpFastCache($c['storage'], $CI->config->item('fastcache'));
 }
开发者ID:sevir,项目名称:toffy-lite,代码行数:20,代码来源:FastCache.php


示例6: getPhotosByHighglithFirst

function getPhotosByHighglithFirst($category)
{
    global $detect;
    $cache = phpFastCache();
    if (isset($_GET['clear_cache'])) {
        $cache->delete('posts');
    }
    $posts = $cache->get("posts");
    if (!$posts || $posts == null) {
        $posts = getPhotos($category, false);
        $posts = getPhotos($category, $posts);
        // cache for an hour
        $cache->set("posts", $posts, 3000);
    }
    return $posts;
}
开发者ID:heldrida,项目名称:freedomnow,代码行数:16,代码来源:helperFns.php


示例7: 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;
 }
开发者ID:jassonlazo,项目名称:GamersInvasion-Peliculas,代码行数:17,代码来源:vtplugins.php


示例8: get_shahinfo

/**
* 获得详情页数据
*/
function get_shahinfo($hash)
{
    if (preg_match('/^[0-9A-Z]+$/u', $hash)) {
        $cache = phpFastCache("files", array("path" => "cache"));
        $conter = $cache->get($hash);
        if (is_null($conter)) {
            $url = 'http://www.torrentkitty.org/information/';
            $content = get_data($url . $hash);
            $html = new simple_html_dom();
            $html->load($content);
            @($ret = $html->find('h3'));
            if (isset($ret['0']->nodes['0']->_['4']) && $ret['0']->nodes['0']->_['4'] == 'Magnet Link does not eixst. You may try to upload it again.') {
                $info['error'] = TRUE;
            } else {
                foreach ($html->find('.magnet-link') as $article) {
                    $item['magnet'] = $article->plaintext;
                    $articles[] = $item;
                }
                foreach ($html->find('.detailSummary') as $article) {
                    foreach ($article->find('tr') as $tr) {
                        foreach ($article->find('td') as $td) {
                            $item[] = $td->plaintext;
                        }
                    }
                }
                preg_match('%<table[^>]*id="torrentDetail"[^>]*>(.*?) </table>%si', $content, $match);
                preg_match('%<h2>(.*?)</h2>%si', $content, $ret);
                $title = mb_substr($ret['0'], 25);
                $info['title'] = strip_tags($title);
                $info['list'] = $match;
                $info['size'] = $item['3'];
                $info['quantity'] = $item['2'];
                $info['cdate'] = $item['4'];
                $info['magnetic'] = $articles['0']['magnet'];
                $cache->set($hash, $info, 864000);
            }
        } else {
            $info = $conter;
        }
    } else {
        $info['error'] = TRUE;
    }
    return $info;
}
开发者ID:supertanglang,项目名称:BT-Search,代码行数:47,代码来源:function.php


示例9: 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();
    }
}
开发者ID:kostastzo,项目名称:Cometchat,代码行数:14,代码来源:cometchat_shared.php


示例10: loadRAWData

function loadRAWData($from, $id_plan, $id_item, $to = null, $id_host = null)
{
    $cacheAge = 60 * 60;
    $offset = getOffset();
    setTimezone();
    $cache = phpFastCache();
    //$cache->clean();
    $dt = getDates($from);
    $from = $dt[0];
    if ($to == null) {
        $to = $dt[1];
    }
    $from = str_replace("-", "/", $from);
    $to = str_replace("-", "/", $to);
    $phour = getPeakHours();
    $unit = getUnit($id_item);
    $plan = getPlan($id_plan);
    $item = getItem($id_item);
    $div = 1;
    if (strtolower($unit) == 'bps') {
        $div = 1024 * 1024;
        $unit = 'Mbps';
    }
    $rtag = "";
    foreach ($_SESSION['tag'] as $key => $value) {
        if ($key != "" && $key != "None") {
            $rtag = $rtag . ',"' . $key . '"';
        }
    }
    if ($rtag == '') {
        $rtag = 'bm_tags.tag like "%"';
    } else {
        $rtag = 'bm_tags.tag in (' . substr($rtag, 1) . ')';
    }
    if ($id_plan == 0) {
        $id_plan = '> 0';
    } else {
        $id_plan = '=' . $id_plan;
    }
    if ($id_host == null) {
        $id_host = "";
    } else {
        $id_host = " and bm_host.id_host=" . $id_host;
    }
    $hosts = 'select bm_host.id_host,bm_host.id_plan,bm_plan.plan,bm_plan.nacD,bm_plan.nacU,bm_threshold.critical,bm_threshold.warning,bm_threshold.nominal,bm_host.host
						from bm_host,bm_plan,bm_plan_groups,bm_threshold,bi_dashboard
						where bm_host.id_plan=bm_plan.id_plan
							and bm_host.groupid = ' . $_SESSION['groupid'] . '
							and bm_plan.id_plan ' . $id_plan . '
							and bm_plan_groups.id_plan = bm_plan.id_plan
							and bm_host.borrado=0
							and bm_host.id_plan=bm_plan.id_plan
							and bm_plan_groups.groupid=bm_host.groupid
							and bm_threshold.id_item=bi_dashboard.id_item
							and bm_host.id_host in (select id from bm_tags where ' . $rtag . ')
							and bi_dashboard.id_item=' . $id_item . $id_host . '
						order by bm_host.id_plan';
    //var_dump($hosts);
    // Find Percentile 5 and 95
    if (true) {
        $hostsr = mysql_query($hosts);
        while ($host = mysql_fetch_array($hostsr, MYSQL_ASSOC)) {
            $id_host = $host['id_host'];
            $hostName = $host['host'];
            $nominal = $host['nominal'];
            $critical = $host['critical'];
            $warning = $host['warning'];
            $nacD = $host['nacD'] * 1024;
            $nacU = $host['nacU'] * 1024;
            if ($nominal == -1) {
                $nominal = $nacD;
            }
            if ($nominal == -2) {
                $nominal = $nacU;
            }
            $hostList[] = array('host' => $hostName, 'id_host' => $id_host, 'nominal' => $nominal, 'critical' => $critical, 'warning' => $warning, 'nacD' => $nacD, 'nacU' => $nacU);
            $incache = true;
            unset($cachedData);
            $dfrom = $key = date('Y/m/d', strtotime($from . ' -1 days'));
            while ($dfrom != $to) {
                $dfrom = date('Y/m/d', strtotime($dfrom . ' +1 days'));
                $key = $dfrom . '-' . $id_host . '-' . $id_item;
                //if (isset($_SESSION['cache'][$key]))
                //	$obj = $_SESSION['cache'][$key];
                //else
                //echo $key . "<br>";
                $obj = $cache->get($key);
                if ($obj == null) {
                    $incache = false;
                    $_SESSION['cacheFull'] = false;
                } else {
                    $_SESSION['cachePartial'] = true;
                    foreach ($obj as $key => $value) {
                        if (isset($value['clock'])) {
                            $cachedData[] = $value;
                        }
                    }
                }
            }
            if (!isset($cachedData)) {
//.........这里部分代码省略.........
开发者ID:rafaelurrutia,项目名称:bmonitor-y-bi,代码行数:101,代码来源:db.php


示例11: array

/* edition, for createing a weighted average.     */
$gStatsWPEditions = array('zh' => 935, 'en' => 387, 'es' => 365, 'hi' => 295, 'ar' => 295);
/* Gallery images are picked from pictures        */
/* in Wikipedia articles. What WP editions should */
/* we scan for images?                            */
$gImageSourceWPEditions = array('en', 'es', 'de', 'nl');
// ruwp contains a lot pf portraits as genre pictures,
// hence commenting out
/* When retriving images from Wikipedia pages, we */
/* want to exclude some pics that are often used  */
/* to illustrate navigation boxes and similar.    */
/* NB: Space, not underscore in filenames!        */
$gImageBlacklist = array('Tom Sawyer 1876 frontispiece.jpg', 'Nobel Prize.png', 'Дмитрий Иванович Менделеев 8.jpg', 'Charles_Darwin_1880.jpg', 'Agnes von Kurowsky in Milan.jpg', 'Merton College front quad.jpg', 'St John\'s Church, Little Gidding.jpg', 'Vivienne Haigh-Wood Eliot 1920.jpg', 'Harper Midway Chicago.jpg', 'University of Minnesota-20031209.jpg', 'Bronze Star medal.jpg', 'Air Medal front.jpg', 'Meritorious Service Medal (United_States).png', 'Purpleheart.jpg', 'Dfc-usa.jpg', 'Us legion of merit legionnaire.png', 'Silver Star medal.png', 'Conservative Elephant.png', '2006 AEGold Proof Obv.png');
/* Cache type. Can be auto, memcache, files, etc. */
/* see http://www.phpfastcache.com/ for full list */
$gCache = phpFastCache("auto");
# Example, using a local Redis server:
#$gCache = phpFastCache("redis");
#$gCache->config['redis']['server'] = '127.0.0.1';
#$gCache->config['redis']['port'] = '6379';
/* The number of hours to cache external data on  */
/* individual laureates, e.g. Wikipedia images    */
$gExternalLaureateDataCacheTime = 720;
/* The number of hours to store external stats,   */
/* e.g. Wikipedia pageviews                       */
$gExternalStatsCacheTime = 36;
/* Should we cache responses from local API's? If */
/* our caching is not superfast, and API's are on */
/* on the same server, it might be faster not to. */
$gCacheLocal = true;
/* Time zone to use when fetching statistics      */
开发者ID:jplusplus,项目名称:nobel,代码行数:31,代码来源:settings.default.php


示例12: mysqli_select_db

if (!$dbh) {
    echo "<h3>Unable to connect to database. Please check details in configuration file.</h3>";
    exit;
}
mysqli_select_db($dbh, DB_NAME);
mysqli_query($GLOBALS['dbh'], "SET NAMES utf8");
mysqli_query($GLOBALS['dbh'], "SET CHARACTER SET utf8");
mysqli_query($GLOBALS['dbh'], "SET COLLATION_CONNECTION = 'utf8_general_ci'");
if (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(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'cache');
    phpFastCache::setup("storage", MC_NAME);
    $memcache = phpFastCache();
    $memcache->set('auth', 'o1k', 30);
}
$usertable = TABLE_PREFIX . DB_USERTABLE;
$usertable_username = DB_USERTABLE_NAME;
$usertable_userid = DB_USERTABLE_USERID;
$body = '';
if (!empty($_POST['username'])) {
    $_SESSION['cometchat']['cometchat_admin_user'] = $_POST['username'];
}
if (!empty($_POST['password'])) {
    $_SESSION['cometchat']['cometchat_admin_pass'] = $_POST['password'];
}
authenticate();
$module = "dashboard";
$action = "index";
开发者ID:rodino25,项目名称:tsv2,代码行数:31,代码来源:index.php


示例13: __construct

 /**
  * Constructor.
  * @access public
  *
  */
 public function __construct()
 {
     // Auto-load classes on demand
     if (function_exists("__autoload")) {
         spl_autoload_register("__autoload");
     }
     spl_autoload_register(array($this, 'autoload'));
     // Define constants
     $this->define_constants();
     // Include required files
     $this->includes();
     $this->API_key = "b01d4d3fea131c822c72eb8c3e9d85b83c2beac92ac9fab197e932c4b20a71c0";
     //"a871cfc48ef1ee01f27d7c773aacd6a7c5b2ae80203d0401c3f0c1fc8354f0a2";
     $this->API_account = "83442";
     // Init API
     $this->api = new LI_API($this->API_key, $this->API_account);
     // simple Caching with:
     $this->LI_cache = phpFastCache();
     // set xml directory
     $this->XML_dir_matrices = $this->plugin_path() . '/xml/matrices/';
     // set xml directory
     $this->XML_dir_items = $this->plugin_path() . '/xml/items/';
     // set xml directory
     $this->XML_dir_vendors = $this->plugin_path() . '/xml/vendors/';
     $this->XML_dir_manufacturers = $this->plugin_path() . '/xml/manufacturers/';
     //$this->options = get_option('lightspeed_inteleck_options');
     /*if(is_admin()) {
     			require_once(LSI_DIR_PATH.'views/lsi-options.php'); // include options file
     			$options_page = new lightspeedImportOptions();
     			add_action('admin_menu', array($options_page, 'add_pages')); // adds page to menu
     			add_action('admin_init', array($options_page, 'register_settings'));
     		}*/
     register_activation_hook(__FILE__, array($this, 'lightspeed_import_activation'));
     register_deactivation_hook(__FILE__, array($this, 'lightspeed_import_deactivation'));
     add_action('lightspeed_hourly_product_import', array($this, 'lightspeed_import_items'));
     add_action('lightspeed_hourly_matrices_import', array($this, 'lightspeed_import_matrices'));
     add_action('lightspeed_hourly_vendors_import', array($this, 'lightspeed_import_vendors'));
     add_action('lightspeed_hourly_manufacturers_import', array($this, 'lightspeed_import_manufacturers'));
 }
开发者ID:binq2,项目名称:borealpaddle,代码行数:44,代码来源:lightspeed-import.php


示例14: Cache

 public function Cache()
 {
     $this->control = Control::getControl();
     $this->phpFastCache = phpFastCache();
 }
开发者ID:TriiiHoldingsLtd,项目名称:php-framework,代码行数:5,代码来源:Cache.class.php


示例15: loadApontamentosDiasDistintos

 public function loadApontamentosDiasDistintos($connection, $tipoApontamento)
 {
     $cache = phpFastCache();
     $apontamentosCache = $cache->get("ApontamentosDiasDistintos" . $tipoApontamento);
     if ($apontamentosCache != null) {
         return $apontamentosCache;
     } else {
         $registros = array();
         $query = " SELECT *\n                       FROM   apontamentos\n                       WHERE  apo_dtdinicio NOT LIKE '%0000%'\n                       AND    apo_dtdfim    NOT LIKE '%0000%'\n                       AND    DAY(apo_dtdinicio) <> DAY(apo_dtdfim) ";
         if (!Functions::isEmpty($tipoApontamento) && $tipoApontamento == "A") {
             $query .= " AND apo_cdiatividade IS NOT NULL ";
         }
         if (!Functions::isEmpty($tipoApontamento) && $tipoApontamento == "C") {
             $query .= " AND apo_cdichamado   IS NOT NULL ";
         }
         $query .= " ORDER  BY apo_cdiapontamento ";
         $stmt = $connection->prepare($query);
         $stmt->execute();
         $rows = $stmt->fetchAll();
         foreach ($rows as $row) {
             $vo = $this->populateVo($connection, $row);
             array_push($registros, $vo);
         }
         $cache->set("ApontamentosDiasDistintos" . $tipoApontamento, $registros, 60 * Functions::getParametro('cache'));
         return $registros;
     }
 }
开发者ID:mmlcasag,项目名称:basisit,代码行数:27,代码来源:ApontamentosModel.php


示例16: array

<?php

return array('Cache' => function () {
    $config = (require \App::path() . '/app/config/cache.php');
    \phpFastCache::setup($config);
    return phpFastCache();
}, 'Crypt' => 'Disco\\classes\\Crypt', 'Data' => 'Disco\\classes\\Data', 'DB' => 'Disco\\classes\\PDO', 'Event' => 'Disco\\classes\\Event', 'Email' => 'Disco\\classes\\Email', 'FileHelper' => 'Disco\\classes\\FileHelper', 'Form' => 'Disco\\classes\\Form', 'Html' => 'Disco\\classes\\Html', 'Model' => 'Disco\\classes\\ModelFactory', 'Queue' => 'Disco\\classes\\Queue', 'Request' => 'Disco\\classes\\Request', 'Session' => 'Disco\\classes\\Session', 'Template' => 'Disco\\classes\\Template', 'View' => 'Disco\\classes\\View', 'User' => 'App\\service\\User');
开发者ID:discophp,项目名称:project,代码行数:7,代码来源:services.php


示例17: SetCachedVersion

 function SetCachedVersion($function, $unique_id, $args_id, $data)
 {
     // In your config file
     //		require_once(dirname(__FILE__) . "/phpfastcache.php");
     phpFastCache::setup("storage", "redis");
     #default global for everywhere.
     //		 phpFastCache support "redis", "cookie", "apc", "memcache", "memcached", "wincache" ,"files", "sqlite" and "xcache";
     // You don't need to change your code when you change your caching system, blank will use default global:
     $cache = phpFastCache("files");
     $id = md5($function . $unique_id . $args_id);
     $results = $cache->get("cache_" . $id);
     if ($results) {
         return $results;
     }
     return $results;
     //
 }
开发者ID:jordone,项目名称:diyonline,代码行数:17,代码来源:leadtracapi.php


示例18: array

<?php

/*
 * Learn how to setup phpFastCache ?
 */
require_once "../phpfastcache.php";
/*
 * Now this is Optional Config setup for default phpFastCache
 */
$config = array("storage" => "auto", "default_chmod" => 0777, "htaccess" => true, "path" => "", "securityKey" => "auto", "memcache" => array(array("127.0.0.1", 11211, 1)), "redis" => array("host" => "127.0.0.1", "port" => "", "password" => "", "database" => "", "timeout" => ""), "extensions" => array(), "fallback" => "files");
phpFastCache::setup($config);
// OR
phpFastCache::setup("storage", "files");
phpFastCache::setup("path", dirname(__FILE__));
/*
 * End Optional Config
 */
$config = array();
$cache = phpFastCache("files", $config);
// this will be $config['storage'] up there;
// changing config example
$cache->setup("path", "new_path");
$cache2 = phpFastCache("memcache");
// this will use memcache
$server = array(array("127.0.0.1", 11211, 1));
$cache2->setup("memcache", $server);
开发者ID:artifex404,项目名称:grav-plugin-instagram,代码行数:26,代码来源:2.setup.php


示例19: __construct

 public function __construct()
 {
     global $container;
     $container = new Container();
     $container['session'] = function ($container) {
         $session = new Session();
         if (session_id() == '') {
             $session->start();
         }
         return $session;
     };
     $container['request'] = function ($container) {
         $request = Request::createFromGlobals();
         return $request;
     };
     $container['config'] = function ($container) {
         $config = new ConfigHelper();
         return $config->objInstance;
     };
     $container['translator'] = function ($container) {
         $request = $container['request'];
         $translator = new TranslateHelper($request);
         return $translator->objInstance;
     };
     $container['cacheType'] = $container['config']["fastChatType"];
     $container['fastcache'] = function ($container) {
         phpFastCache::setup("storage", $container['cacheType']);
         phpFastCache::setup("path", BASE_ROOT . "/cache/fastcache/");
         $cache = phpFastCache();
         return $cache;
     };
     $container['twig'] = function ($container) {
         $config = $container['config'];
         $translator = $container['translator'];
         $arrayOfFileSystem = [BASE_ROOT . '/pages/Admin/templates/modules', BASE_ROOT . '/pages/Admin/templates/emails', BASE_ROOT . '/pages/Admin/modules/GererItemShop/templates', BASE_ROOT . '/pages/Admin/modules/GererEquipeJeu/templates', BASE_ROOT . '/pages/Admin/modules/GererEquipeSite/templates', BASE_ROOT . '/pages/Admin/modules/Parametres/templates', BASE_ROOT . '/pages/ItemShop/modules/Hipay/templates', BASE_ROOT . '/pages/ItemShop/modules/Starpass/templates', BASE_ROOT . '/pages/Classements/templates/', BASE_ROOT . '/pages/Inscription/templates/modules', BASE_ROOT . '/pages/Inscription/templates/emails', BASE_ROOT . '/pages/ItemShop/templates/modules', BASE_ROOT . '/pages/ItemShop/templates/emails', BASE_ROOT . '/pages/Messagerie/templates/modules', BASE_ROOT . '/pages/Messagerie/templates/emails', BASE_ROOT . '/pages/Marche/templates/modules', BASE_ROOT . '/pages/Marche/templates/emails', BASE_ROOT . '/pages/MonCompte/templates/modules', BASE_ROOT . '/pages/MonCompte/templates/emails', BASE_ROOT . '/pages/MonPersonnage/templates/modules', BASE_ROOT . '/pages/MonPersonnage/templates/emails', BASE_ROOT . '/pages/Statistiques/templates/modules', BASE_ROOT . '/pages/Votes/templates/', BASE_ROOT . '/pages/_LegacyPages/templates/', BASE_ROOT . '/pages/_Home/templates/modules/', BASE_ROOT . '/core/templates/'];
         if ($config["twigCache"]) {
             $urlCache = BASE_ROOT . $config["twigCacheUrl"];
         } else {
             $urlCache = false;
         }
         $loader = new Twig_Loader_Filesystem($arrayOfFileSystem);
         $twig = new Twig_Environment($loader, array('cache' => $urlCache));
         $twig->addExtension(new Twig_Extensions_Extension_Text());
         $twig->addExtension(new StringFunctionExtension());
         $twig->addExtension(new FonctionsUtilesExtension());
         $twig->addExtension(new HelperExtension());
         $twig->addExtension(new ImageFunctionExtension());
         $twig->addExtension(new DateFunctionExtension());
         $twig->addExtension(new Twig_Extension_Debug());
         $twig->addExtension(new EncryptExtension());
         include BASE_ROOT . '/pages/Tableaux_Arrays.php';
         $twig->addExtension(new \Symfony\Bridge\Twig\Extension\TranslationExtension($translator));
         $twig->addGlobal('session', $container['session']);
         $twig->addGlobal('request', $container['request']);
         $twig->addGlobal('config', $container['config']);
         $twig->addGlobal('urlBase', BASE_ROOT);
         return $twig;
     };
     $container['doctrine.eventManager'] = function ($container) {
         $eventManager = new \Doctrine\Common\EventManager();
         return $eventManager;
     };
     $container['doctrine.connection.default'] = function ($container) {
         $param = $container['config'];
         $config = new \Doctrine\DBAL\Configuration();
         // build connection parameters
         $connectionParameters = array('dbname' => "site", 'user' => $param["bdd"]["user"], 'password' => $param["bdd"]["password"], 'host' => $param["bdd"]["host"], 'port' => $param["bdd"]["port"]);
         switch (strtolower($param["bdd"]["driver"])) {
             case 'mysql':
                 $connectionParameters['driver'] = 'pdo_mysql';
                 $connectionParameters['charset'] = strtolower($param["bdd"]["charset"]);
                 break;
             default:
                 throw new RuntimeException('Database driver ' . $param["bdd"]["driver"] . ' not known by doctrine.');
         }
         /* if (!empty($GLOBALS['TL_CONFIG']['dbPdoDriverOptions'])) {
            $connectionParameters['driverOptions'] = deserialize($GLOBALS['TL_CONFIG']['dbPdoDriverOptions'], true);
            } */
         $connectionParameters['defaultTableOptions'] = array('collate' => 'utf8_general_ci');
         /** @var \Doctrine\Common\EventManager $eventManager */
         $eventManager = $container['doctrine.eventManager'];
         // establish connection
         $connection = \Doctrine\DBAL\DriverManager::getConnection($connectionParameters, $config, $eventManager);
         $connection->getConfiguration()->setSQLLogger(null);
         // fix platform differences
         $platform = $connection->getDatabasePlatform();
         $platform->registerDoctrineTypeMapping('bit', 'boolean');
         return $connection;
     };
     $container['doctrine.orm.entitiesCacheDir'] = function ($container) {
         $entitiesCacheDir = BASE_ROOT . '/cache/doctrine/entities';
         if (!is_dir($entitiesCacheDir)) {
             mkdir($entitiesCacheDir, 0777, true);
         }
         $classLoader = new \Composer\Autoload\ClassLoader();
         $classLoader->add('', array($entitiesCacheDir), true);
         $classLoader->register(true);
         $container['doctrine.orm.entitiesClassLoader'] = $classLoader;
         return $entitiesCacheDir;
     };
//.........这里部分代码省略.........
开发者ID:SylvainSimon,项目名称:Metinify,代码行数:101,代码来源:ServicesHelper.php


示例20: 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;
 }
开发者ID:rootcave,项目名称:9livesprints-web,代码行数:9,代码来源:functions.php



注:本文中的phpFastCache函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP php_Month_num函数代码示例发布时间:2022-05-15
下一篇:
PHP phpDocumentor_parse_ini_file函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap