当前位置: 首页>>代码示例>>PHP>>正文


PHP phpFastCache::storage方法代码示例

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


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

示例1: _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

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

示例3: array

 function __construct($storage = "", $option = array())
 {
     if (isset(self::$config['fallback'][$storage])) {
         $storage = self::$config['fallback'][$storage];
     }
     if ($storage == "") {
         $storage = self::$storage;
         self::option("storage", $storage);
     } else {
         self::$storage = $storage;
     }
     $this->tmp['storage'] = $storage;
     $this->option = array_merge($this->option, self::$config, $option);
     if ($storage != "auto" && $storage != "" && $this->isExistingDriver($storage)) {
         $driver = "phpfastcache_" . $storage;
     } else {
         $storage = $this->autoDriver();
         self::$storage = $storage;
         $driver = "phpfastcache_" . $storage;
     }
     require_once dirname(__FILE__) . "/drivers/" . $storage . ".php";
     $this->option("storage", $storage);
     if ($this->option['securityKey'] == "auto" || $this->option['securityKey'] == "") {
         $suffix = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : get_current_user();
         $this->option['securityKey'] = "cache.storage." . $suffix;
     }
     $this->driver = new $driver($this->option);
     $this->driver->is_driver = true;
 }
开发者ID:ajisantoso,项目名称:kateglo,代码行数:29,代码来源:phpfastcache.php

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

示例5: array

 function __construct($storage = "", $option = array())
 {
     if ($storage == "") {
         $storage = self::$storage;
         self::option("storage", $storage);
     } else {
         self::$storage = $storage;
     }
     $this->tmp['storage'] = $storage;
     $this->option = array_merge($this->option, self::$config, $option);
     if ($storage != "auto" && $storage != "" && $this->isExistingDriver($storage)) {
         $driver = "phpfastcache_" . $storage;
     } else {
         $storage = $this->autoDriver();
         self::$storage = $storage;
         $driver = "phpfastcache_" . $storage;
     }
     require_once dirname(__FILE__) . "/drivers/" . $storage . ".php";
     $this->option("storage", $storage);
     if ($this->option['securityKey'] == "auto" || $this->option['securityKey'] == "") {
         $suffix = isset($_SERVER['HTTP_HOST']) ? str_replace("www.", "", strtolower($_SERVER['HTTP_HOST'])) : get_current_user();
         $this->option['securityKey'] = "cache.storage." . $suffix;
     }
     $this->driver = new $driver($this->option);
     $this->fallback = !$this->driver->checkdriver();
     // do fallback
     if (method_exists($this->driver, "connectServer")) {
         $this->driver->connectServer();
     }
     if ($this->driver->fallback === true) {
         //	echo 'Fall Back';
         require_once dirname(__FILE__) . "/drivers/" . $this->option['fallback'] . ".php";
         $driver = "phpfastcache_" . $this->option['fallback'];
         $this->option("storage", $this->option['fallback']);
         $this->driver = new $driver($this->option);
         $this->driver->is_driver = true;
         $this->fallback = true;
     } else {
         $this->driver->is_driver = true;
         $this->fallback = false;
     }
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:42,代码来源:base.php

示例6: array

 function __construct($storage = "", $option = array())
 {
     if (isset(self::$config['fallback'][$storage])) {
         $storage = self::$config['fallback'][$storage];
     }
     if ($storage == "") {
         $storage = self::$storage;
         self::option("storage", $storage);
     } else {
         self::$storage = $storage;
     }
     $this->tmp['storage'] = $storage;
     $this->option = array_merge($this->option, self::$config, $option);
     if ($storage != "auto" && $storage != "" && $this->isExistingDriver($storage)) {
         $driver = "phpfastcache_" . $storage;
     } else {
         $storage = $this->autoDriver();
         self::$storage = $storage;
         $driver = "phpfastcache_" . $storage;
     }
     $this->option("storage", $storage);
     if ($this->option['securityKey'] == "auto" || $this->option['securityKey'] == "") {
         $this->option['securityKey'] = "cache.storage." . $_SERVER['HTTP_HOST'];
     }
     $this->driver = new $driver($this->option);
     $this->driver->is_driver = true;
 }
开发者ID:networksoft,项目名称:goldenquick.pekcellgold.com,代码行数:27,代码来源:cometchat_cache.php

示例7: setup

 public static function setup($name, $value = "")
 {
     if (!is_array($name)) {
         if ($name == "storage") {
             self::$storage = $value;
         }
         self::$config[$name] = $value;
     } else {
         foreach ($name as $n => $value) {
             self::setup($n, $value);
         }
     }
 }
开发者ID:licailing,项目名称:licailing,代码行数:13,代码来源:MicroPHP.php

示例8:

<?php

include "php_fast_cache.php";
phpFastCache::$storage = "auto";
// ready ?
// check in case first
$content = phpFastCache::get("keyword1");
if ($content == null) {
    // for testing
    echo "This is not caching, page is render with lot queires and slow speed <br>";
    // do what you want, like get content from cURL | API | mySQL Query and return result to $content
    $content = file_get_contents("http://www.phpfastcache.com/testing.php");
    // rewrite cache for other request in 5 seconds
    phpFastCache::set("keyword1", $content, 5);
} else {
    // use cache
    // node
    echo "THIS TIME USE CACHE, FAST! <br>";
}
echo "TRY F5 to refesh the page to see new SPEED with Cache!<br>";
echo $content;
开发者ID:sankam-nikolya,项目名称:lptt,代码行数:21,代码来源:example.php

示例9: array

$caching = array("auto", "files", "pdo", "mpdo", "xcache", "apc", "memcache", "memcached", "wincache");
$tmp = new phpFastCache();
// data use for caching ^ testing
$data = array(1, "abc hello world", "", null, 0, array(1, 2, 3, 4, "string", null, "", "GOT IT", "KEY" => "VALUE", "N" => null, "E" => "", "X" => -1));
// $data = array(null,null,"",null);
echo "Try get Server information ... Take 10 - 15 seconds to detect ...<br>";
phpFastCache::debug(phpFastCache::systemInfo());
echo "<b>Data will be testing - Included NULL and Emptry String</b>";
phpFastCache::debug($data);
$c = array("red", "blue", "green", "orange", "black", "red", "blue", "green", "orange", "black");
$xx = 0;
foreach ($caching as $st) {
    $dem = 0;
    $color = $c[$xx];
    $xx++;
    phpFastCache::$storage = $st;
    echo "<font color={$color} >\n    ------------------------------------------------- <br>\n    Caching = {$st} <br>";
    if (isset(phpFastCache::$sys['drivers'][$st]) && phpFastCache::$sys['drivers'][$st] == true || $st == "auto") {
        foreach ($data as $string) {
            $dem++;
            echo "SET {$dem} --> ";
            phpFastCache::set("A" . $dem, $string);
            echo "GET {$dem} = ";
            $x = phpFastCache::get("A" . $dem);
            if (is_array($x)) {
                print_r($x);
            } else {
                echo $x;
                if (is_numeric($x)) {
                    phpFastCache::increment("A" . $dem);
                    phpFastCache::increment("A" . $dem);
开发者ID:sankam-nikolya,项目名称:lptt,代码行数:31,代码来源:testing.php

示例10: 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'];
 }
开发者ID:Quantumke,项目名称:ken,代码行数:84,代码来源:php_fast_cache.php


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