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


PHP apc_exists函数代码示例

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


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

示例1: exists

 public function exists($key)
 {
     if (Armory::$armoryconfig['useApc'] == false) {
         return false;
     }
     return apc_exists(md5(Armory::$armoryconfig['cachePrefix'] . '_' . $key));
 }
开发者ID:Lankytim,项目名称:wowarmory,代码行数:7,代码来源:cache.apc.php

示例2: getURL

function getURL($id)
{
    extract(shortcode_atts(array('id' => 'id'), $id));
    $URL = "http://localhost/adsManagement/getAdd.php";
    if ($id != "id") {
        $hit = apc_exists($id);
        if (!$hit) {
            $URL .= "?id=" . $id;
            $content = file_get_contents($URL);
            apc_store($id, $content);
            //create an index on array to store impr and store set num time to 0
            if (!apc_exists("impr")) {
                $impr[$id] = 0;
                apc_store("impr", new ArrayObject($impr));
            }
        } else {
            $content = apc_fetch($id);
            if (apc_exists("impr")) {
                $impr = apc_fetch("impr");
                $impr[$id] = $impr[$id] + 1;
                apc_store("impr", new ArrayObject($impr));
            }
        }
    } else {
        $content = file_get_contents($URL);
    }
    return $content;
}
开发者ID:noorbakerally,项目名称:Development,代码行数:28,代码来源:displayAdds.php

示例3: autoload

 /**
  * 自动加载类对应的文件
  *
  * @param string $package_name 类名
  *
  * @return void
  */
 public static function autoload($package_name)
 {
     $u_name = APP_NAME . 'al:' . $package_name;
     if (KISS::enableCache() && apc_exists($u_name)) {
         $filename = apc_fetch($u_name);
         include_once $filename;
         self::$_load_array[$package_name] = $filename;
         self::$_new_class_found = true;
         return;
     }
     $package_array = preg_split('/_/', $package_name);
     $file_array[] = join('/', $package_array);
     $file_array[] = strtolower($file_array[0]);
     array_push($package_array, 'class.' . array_pop($package_array));
     $file_array[] = join('/', $package_array);
     $file_array[] = strtolower($file_array[2]);
     $path_array = explode(PATH_SEPARATOR, ini_get('include_path'));
     foreach ($path_array as $path) {
         foreach ($file_array as $file) {
             $filename = "{$path}/{$file}.php";
             if (file_exists($filename)) {
                 include_once $filename;
                 if (KISS::enableCache()) {
                     apc_store($u_name, $filename);
                 }
                 self::$_load_array[$package_name] = $filename;
                 self::$_new_class_found = true;
                 return;
             }
         }
     }
 }
开发者ID:iwater,项目名称:kissphp,代码行数:39,代码来源:KISS.php

示例4: read

 public function read()
 {
     if (!apc_exists($this->key)) {
         return array('_global' => array());
     }
     return apc_fetch($this->key);
 }
开发者ID:ArtifexTech,项目名称:life-jacket,代码行数:7,代码来源:Apc.php

示例5: query

function query($type)
{
    if (!is_null($type)) {
        //get parameter data
        $parameters = Flight::request()->query->getData();
        $cacheKey = $type . json_encode($parameters);
        if (apc_exists($cacheKey)) {
            echo apc_fetch($cacheKey);
        } else {
            $url = 'http://localhost:8080/sparql';
            $query_string = file_get_contents('queries/' . $type . '.txt');
            foreach ($parameters as $key => $value) {
                $query_string = str_replace('{' . $key . '}', $value, $query_string);
            }
            //open connection
            $ch = curl_init();
            //set the url, number of POST vars, POST data
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/sparql-query"));
            curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            //execute post
            $result = curl_exec($ch);
            //close connection
            curl_close($ch);
            apc_store($cacheKey, $result);
            echo $result;
        }
    }
}
开发者ID:eugenesiow,项目名称:ldanalytics-PiSmartHome,代码行数:30,代码来源:query.php

示例6: get

 /**
  * {@inheritdoc}
  *
  * @see \LosMiddleware\RateLimit\Storage\StorageInterface::get()
  */
 public function get($key, $default = 0)
 {
     if (!apc_exists($this->prefix . $key)) {
         return $default;
     }
     return apc_fetch($this->prefix . $key);
 }
开发者ID:samsonasik,项目名称:LosRateLimit,代码行数:12,代码来源:ApcStorage.php

示例7: exists

 /**
  * Check if key exists.
  *
  * @param $key
  * @return mixed
  */
 public function exists($key)
 {
     if (!$this->open()) {
         return false;
     }
     return apc_exists($key);
 }
开发者ID:nesbert,项目名称:nobjects,代码行数:13,代码来源:Apc.php

示例8: fetch

 public function fetch($key, $default = '')
 {
     if (!apc_exists($this->hash($key))) {
         return $default;
     }
     return apc_fetch($this->hash($key));
 }
开发者ID:ArtifexTech,项目名称:life-jacket,代码行数:7,代码来源:Apc.php

示例9: has

 /**
  * {@inheritdoc}
  */
 public function has($name)
 {
     if ($this->driver == self::APCU_DRIVER) {
         return apcu_exists($this->prefix . $name);
     }
     return apc_exists($this->prefix . $name);
 }
开发者ID:tuneyourserver,项目名称:components,代码行数:10,代码来源:APCStore.php

示例10: update

 public function update($arg_key, $arg_value, $arg_expire = null)
 {
     if (apc_exists($arg_key)) {
         return apc_store($arg_key, $arg_value);
     }
     return false;
 }
开发者ID:BPing,项目名称:PHPCbping,代码行数:7,代码来源:Apc_d.class.php

示例11: replace

 /**
  * @param string $timeout
  */
 public function replace($key, $value, $timeout)
 {
     if (!apc_exists($key)) {
         return false;
     }
     apc_store($key, $value, $timeout);
 }
开发者ID:cvweiss,项目名称:zcache,代码行数:10,代码来源:ApcCache.php

示例12: query

 /**
  * Queries a single record from the database given a primary key
  * @return Form
  */
 function query()
 {
     if (defined('MO_USE_APC') && MO_USE_APC == '1') {
         if (function_exists("apc_exists")) {
             if (apc_exists(get_class($this) . "_" . $this->getId()) && $this->getId() > 0) {
                 $fetched_successfully = false;
                 $cached_result = apc_fetch(get_class($this) . "_" . $this->getId(), $fetched_successfully);
                 if ($fetched_successfully) {
                     $this->populate($cached_result);
                     return $cached_result;
                 }
             }
         }
     }
     // If we don't get a cached result, then query from the db
     $model = $this->getModel();
     if (is_object($model)) {
         $result = $model->performQuery($this);
         $this->populate($result);
         if (defined('MO_USE_APC') && MO_USE_APC == '1') {
             if ($this->getId() > 0) {
                 if (function_exists("apc_store")) {
                     apc_store(get_class($this) . "_" . $this->getId(), $result, 14400);
                 }
             }
         }
         return $result;
     }
     return $this;
 }
开发者ID:hiveclick,项目名称:mojavi,代码行数:34,代码来源:MysqlForm.php

示例13: exists

 public function exists($id)
 {
     if (function_exists('apc_exists')) {
         return apc_exists($id);
     }
     return apc_fetch($id) === false ? false : true;
 }
开发者ID:emaphp,项目名称:simplecache,代码行数:7,代码来源:APCProvider.php

示例14: contains

 /**
  * Check if an item is in the cache:
  */
 public function contains($key)
 {
     if (!self::isEnabled()) {
         return false;
     }
     return apc_exists($this->cachePrefix . $key);
 }
开发者ID:dw250100785,项目名称:b8framework,代码行数:10,代码来源:ApcCache.php

示例15: has

 public function has($key)
 {
     if ($this->apcu) {
         return apcu_exists((string) $key);
     }
     return apc_exists((string) $key);
 }
开发者ID:maslosoft,项目名称:cache,代码行数:7,代码来源:Apc.php


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