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

PHP phpFastCache类代码示例

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

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



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

示例1: 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'));
 }
开发者ID:Puzzle-cms,项目名称:puzzle,代码行数:8,代码来源:Common.php


示例2: _initCache

 public function _initCache()
 {
     //$servers = array();
     $cacheCfg = $this->_config->memcached->config;
     $servers = $cacheCfg->toArray();
     if (!empty($servers)) {
         phpFastCache::$storage = "auto";
         $cache = __c($cacheCfg->type);
         $server = array(array($cacheCfg->host, $cacheCfg->port, $cacheCfg->timeout));
         $cache->option("server", $server);
         Registry::set("cache", $cache);
     }
 }
开发者ID:musicsnap,项目名称:Cdoco_Yaf_Ext,代码行数:13,代码来源:Bootstrap.php


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


示例4: SSLForwardJS

 public function SSLForwardJS()
 {
     $ip = $this->getRealIP();
     if (!class_exists("phpFastCache")) {
         die("Please required phpFastCache Class");
     }
     // you should change this to cURL()
     $data = phpFastCache::get("codehelper_ip_ssl" . md5($ip));
     // caching 1 week
     if ($data == null) {
         $url = "http://api.codehelper.io/ips/?callback=codehelper_ip_callback&ip=" . $ip;
         $data = file_get_contents($url);
         phpFastCache::set("codehelper_ip_ssl" . md5($ip), $data, 3600 * 24 * 7);
     }
     return $data;
 }
开发者ID:Inteleck,项目名称:hwc,代码行数:16,代码来源:ip.codehelper.io.php


示例5: testAction

 public function testAction()
 {
     phpFastCache::$storage = "auto";
     $cache = __c("memcache");
     $server = array(array("192.168.10.122", 11211, 100));
     $cache->option("server", $server);
     $cache->keyword = array("something here++++++++++++++++_________", 600);
     //        var_dump($cache->get("31lh9kj9cs3627fauu90njuj26"));
     var_dump($cache->keyword);
     $excel = new CreateExcel();
     //        $excel->setHeader('高子航' . date('Y年m月d日 H:i:s', time()));
     //        $excel->setTitle(array( '高子航'));
     //        $excel->setData(array());
     //        $excel->echoExcel('show_' . date('Y_m_d_H_i_s', time()));
     die;
 }
开发者ID:musicsnap,项目名称:Cdoco_Yaf_Ext,代码行数:16,代码来源:Index.php


示例6: 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


示例7: phpFastCache

 function phpFastCache($storage = "auto", $config = array())
 {
     $storage = strtolower($storage);
     if (empty($config)) {
         $config = phpFastCache::$config;
     }
     if ($storage == "" || $storage == "auto") {
         $storage = phpFastCache::getAutoClass($config);
     }
     $instance = md5(json_encode($config) . $storage);
     if (!isset(phpFastCache_instances::$instances[$instance])) {
         $class = "phpfastcache_" . $storage;
         phpFastCache::required($storage);
         phpFastCache_instances::$instances[$instance] = new $class($config);
     }
     return phpFastCache_instances::$instances[$instance];
 }
开发者ID:border0464111,项目名称:horkos,代码行数:17,代码来源:phpfastcache.php


示例8: SSLForwardJS

 public function SSLForwardJS()
 {
     $ip = $this->getRealIP();
     if (!class_exists("phpFastCache")) {
         die("<div style='border: 2px solid #09f; font-size: .8em; font-family: Arial;background: #FCF0F0;border: 2px solid #F07272;padding: 10px;'>Please enable plugin <b>Cache</b> to run plugin <b>Statistic</b>!</div>");
     }
     // you should change this to cURL()
     $data = phpFastCache::get("codehelper_ip_ssl" . md5($ip));
     // caching 1 week
     if ($data == null) {
         $ctx = stream_context_create(array('http' => array('timeout' => 0.5)));
         $url = "http://api.codehelper.io/ips/?callback=codehelper_ip_callback&ip=" . $ip;
         $json = file_get_html($url);
         phpFastCache::set("codehelper_ip_ssl" . md5($ip), $data, 3600 * 24 * 7);
     }
     return $data;
 }
开发者ID:mul14,项目名称:FiyoCMS,代码行数:17,代码来源:ip.codehelper.io.php


示例9: __construct

 public function __construct()
 {
     $system = CoreLoader::$system;
     date_default_timezone_set($system['default_timezone']);
     $this->registerErrorHandle();
     $this->router = CoreInput::$router;
     $this->input = new CoreInput();
     $this->model = new CoreModelLoader();
     $this->lib = new CoreLibLoader();
     $this->rule = new CoreRule();
     $this->cache = phpFastCache::getInstance($system['cache_config']['storage'], $system['cache_config']);
     if ($system['autoload_db']) {
         $this->database();
     }
     if (!empty($system['language'])) {
         self::$locale = new CoreLocale($system['language']);
     }
     Fn::stripslashes_all();
 }
开发者ID:admpub,项目名称:MicroPHP,代码行数:19,代码来源:Loader.php


示例10: getLocation

 public function getLocation($ip = "")
 {
     if ($ip == "") {
         $ip = $this->getRealIP();
     }
     if (!class_exists("phpFastCache")) {
         die("Please required phpFastCache Class");
     }
     // you should change this to cURL()
     $data = phpFastCache::get("codehelper_ip_" . md5($ip));
     // caching 1 week
     if ($data == null) {
         $url = "http://api.codehelper.io/ips/?php&ip=" . $ip;
         $json = file_get_contents($url);
         $data = json_decode($json, true);
         phpFastCache::set("codehelper_ip_" . md5($ip), $data, 3600 * 24 * 7);
     }
     return $data;
 }
开发者ID:cityware,项目名称:city-utility,代码行数:19,代码来源:IpAddress.php


示例11: 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;
                }
开发者ID:ThatGuySam,项目名称:newest-periscope,代码行数:31,代码来源:index.php


示例12: updatecaching

function updatecaching()
{
    global $ts;
    $conn = 1;
    $errorCode = 0;
    $memcacheAuth = 0;
    include_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . "cometchat_cache.php";
    if ($_POST['MC_NAME'] == 'memcachier') {
        $memcacheAuth = 1;
        $conn = 0;
        $memcache = new MemcacheSASL();
        $memcache->addServer($_POST['MC_SERVER'], $_POST['MC_PORT']);
        if ($memcachierAuth = $memcache->setSaslAuthData($_POST['MC_USERNAME'], $_POST['MC_PASSWORD'])) {
            $memcache->set('auth', 'ok');
            if (!($conn = $memcache->get('auth'))) {
                $errorCode = 3;
            }
            $memcache->delete('auth');
        } else {
            $errorCode = 3;
        }
    } elseif ($_POST['MC_NAME'] != '') {
        $conn = 0;
        $memcacheAuth = 1;
        phpFastCache::setup("storage", $_POST['MC_NAME']);
        $memcache = new phpFastCache();
        $driverPresent = isset($memcache->driver->option['availability']) ? 0 : 1;
        if ($driverPresent) {
            if ($_POST['MC_NAME'] == 'memcache') {
                $server = array(array($_POST['MC_SERVER'], $_POST['MC_PORT'], 1));
                $memcache->option('server', $server);
            }
            $memcache->set('auth', 'ok', 30);
            if (!($conn = $memcache->get('auth'))) {
                $errorCode = 1;
            }
            $memcache->delete('auth');
        }
    }
    if ($conn && !$errorCode) {
        $data = 'define(\'MEMCACHE\',\'' . $memcacheAuth . '\');' . "\r\n";
        $data .= 'define(\'MC_SERVER\',\'' . $_POST['MC_SERVER'] . '\');' . "\t// Set name of your memcache  server\r\n";
        $data .= 'define(\'MC_PORT\',\'' . $_POST['MC_PORT'] . '\');' . "\t\t\t// Set port of your memcache  server\r\n";
        $data .= 'define(\'MC_USERNAME\',\'' . $_POST['MC_USERNAME'] . '\');' . "\t\t\t\t\t\t\t// Set username of memcachier  server\r\n";
        $data .= 'define(\'MC_PASSWORD\',\'' . $_POST['MC_PASSWORD'] . '\');' . "\t\t\t// Set password your memcachier  server\r\n";
        $data .= 'define(\'MC_NAME\',\'' . $_POST['MC_NAME'] . '\');' . "\t\t\t// Set name of caching method if 0 : '', 1 : memcache, 2 : files, 3 : memcachier, 4 : apc, 5 : wincache, 6 : sqlite & 7 : memcached";
        configeditor('MEMCACHE', $data, 0);
        $_SESSION['cometchat']['error'] = 'Caching details updated successfully.';
    } else {
        if ($_POST['MC_NAME'] == 'memcachier') {
            $_SESSION['cometchat']['error'] = 'Failed to update caching details. Please check your Memchachier server details';
        } elseif ($_POST['MC_NAME'] == 'files') {
            $_SESSION['cometchat']['error'] = 'Please check file permission of your cache directory. Please try 755/777/644';
        } elseif ($_POST['MC_NAME'] == 'apc') {
            $_SESSION['cometchat']['error'] = 'Failed to update caching details. Please check your APC configuration.';
        } elseif ($_POST['MC_NAME'] == 'wincache') {
            $_SESSION['cometchat']['error'] = 'Failed to update caching details. Please check your Wincache configuration.';
        } elseif ($_POST['MC_NAME'] == 'sqlite') {
            $_SESSION['cometchat']['error'] = 'Failed to update caching details. Please check your SQLite configuration.';
        } elseif ($_POST['MC_NAME'] == 'memcached') {
            $_SESSION['cometchat']['error'] = 'Failed to update caching details. Please check your Memcached configuration.';
        } else {
            $_SESSION['cometchat']['error'] = 'Failed to update caching details. Please check your Memcache server configuration.';
        }
    }
    header("Location:?module=settings&action=caching&ts={$ts}");
}
开发者ID:networksoft,项目名称:goldenquick.pekcellgold.com,代码行数:67,代码来源:settings.m.php


示例13: 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


示例14: dirname

<?php

// phpFastCache Library
require_once dirname(__FILE__) . "/phpfastcache/2.4.2/base.php";
// OK, setup your cache
phpFastCache::$storage = "files";
//memcache
phpFastCache::$config = array("storage" => phpFastCache::$storage, "fallback" => "files", "securityKey" => "auto", "htaccess" => true, "path" => "", "memcached" => array(array("127.0.0.1", 11211, 1)), "memcache" => array(array("127.0.0.1", 11211, 1)), "server" => array(array("127.0.0.1", 11211, 1)), "redis" => array("host" => "127.0.0.1", "port" => "", "password" => "", "database" => "", "timeout" => ""), "extensions" => array());
phpFastCache::setup(phpFastCache::$config);
// temporary disabled phpFastCache
phpFastCache::$disabled = false;
// default chmod | only change if you know what you are doing
phpFastCache::$default_chmod = "";
// keep it blank, it will use 666 for module and 644 for cgi
开发者ID:sawh,项目名称:ostepu-system,代码行数:14,代码来源:phpfastcache.php


示例15: 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;
}
开发者ID:rafaelurrutia,项目名称:bmonitor-y-bi,代码行数:31,代码来源:db.php


示例16: ErrorException

        echo '<br><b>Error File:</b> ' . $errfile;
        echo '<br><b>Error Line:</b> ' . $errline;
    } else {
        throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
    }
});
// grab the settings
require ROOT . 'settings.php';
// grab status definitions
require SCRIPTROOT . 'statusdefs.php';
// set timezone
date_default_timezone_set('UTC');
// setup cache
require SCRIPTROOT . 'phpfastcache/phpfastcache.php';
phpFastCache::setup('storage', 'files');
phpFastCache::setup('path', ROOT . 'cache');
$cache = phpFastCache();
// setup routing
require SCRIPTROOT . 'AltoRouter/AltoRouter.php';
$routes = new AltoRouter();
// load the actual routes
require ROOT . 'routes.php';
// handle the route request
$route = $routes->match();
// error page handling
function ErrorPage($Error)
{
    ob_get_clean();
    http_response_code($Error);
    $error = $Error;
    require VIEWROOT . 'error.php';
开发者ID:zsbzsb,项目名称:sfmlgamejam,代码行数:31,代码来源:index.php


示例17: phpFastCache

<?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
开发者ID:googlesky,项目名称:QLPM,代码行数:31,代码来源:globalfunction.php


示例18: __setChmodAuto

 protected function __setChmodAuto()
 {
     return phpFastCache::__setChmodAuto($this->config);
 }
开发者ID:nedron92,项目名称:logd-oop,代码行数:4,代码来源:abstract.php


示例19: 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


示例20: dirname

<?php

// phpFastCache Library
require_once dirname(__FILE__) . "/phpfastcache/3.0.0/phpfastcache.php";
// OK, setup your cache
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");
// temporary disabled phpFastCache
phpFastCache::$disabled = false;
开发者ID:SylvainSimon,项目名称:Metinify,代码行数:8,代码来源:phpfastcache.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP phpFlickr类代码示例发布时间:2022-05-23
下一篇:
PHP phpCAS类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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