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


PHP apc_fetch函数代码示例

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


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

示例1: ver

 function ver($id)
 {
     redirect(site_url('fichas/ver/' . $id), 'location', 301);
     if (!($data = apc_fetch('movil_fichas_ver_data' . $id))) {
         $data['theme_page'] = "d";
         $data['theme_header'] = "a";
         $ficha = Doctrine::getTable('Ficha')->findPublicado($id);
         if ($ficha[0]->titulo) {
             $data['title'] = $ficha[0]->titulo;
             if ($ficha[0]->flujo) {
                 $data['content'] = 'movil/verflujo';
             } else {
                 $data['content'] = 'movil/verficha';
             }
             $data['vista_ficha'] = true;
             $data['ficha'] = $ficha[0];
             if ($this->config->item('cache')) {
                 apc_store('movil_fichas_ver_data' . $id, $data, 60 * $this->config->item('cache'));
             }
         } else {
             redirect('movil/ficha/error/');
         }
     }
     $this->load->view('movil/template', $data);
 }
开发者ID:e-gob,项目名称:ChileAtiende,代码行数:25,代码来源:fichas.php

示例2: set

 /**
  * 写入缓存
  * @access public
  * @param string $name 缓存变量名
  * @param mixed $value  存储数据
  * @param integer $expire  有效时间(秒)
  * @return bool
  */
 public function set($name, $value, $expire = null)
 {
     if (is_null($expire)) {
         $expire = $this->options['expire'];
     }
     $name = $this->options['prefix'] . $name;
     if ($result = apc_store($name, $value, $expire)) {
         if ($this->options['length'] > 0) {
             // 记录缓存队列
             $queue = apc_fetch('__info__');
             if (!$queue) {
                 $queue = [];
             }
             if (false === array_search($name, $queue)) {
                 array_push($queue, $name);
             }
             if (count($queue) > $this->options['length']) {
                 // 出列
                 $key = array_shift($queue);
                 // 删除缓存
                 apc_delete($key);
             }
             apc_store('__info__', $queue);
         }
     }
     return $result;
 }
开发者ID:guozqiu,项目名称:think,代码行数:35,代码来源:apc.php

示例3: getValue

 /** gets a value
  *
  * 	@param	string
  * 	@param	mixed	string or array of string
  *
  *	@return	mixed	the value from fastDS
  **/
 protected function getValue($prefix, $keys)
 {
     $success = null;
     if (is_array($keys)) {
         $apcKeys = array();
         foreach ($keys as $key) {
             if (is_string($key)) {
                 $apcKeys[$key] = $this->prefix . $prefix . $key;
             }
         }
         $apc = apc_fetch($apcKeys, $success);
         if (!$success) {
             return false;
         }
         $result = array();
         foreach ($apcKeys as $key => $apcKey) {
             if (isset($apc[$apcKey])) {
                 $result[$key] = $apc[$apcKey];
             }
         }
         return $result;
     }
     $apc = apc_fetch($this->prefix . $prefix . $keys, $success);
     if ($success) {
         return $apc;
     }
     return false;
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:35,代码来源:apc.php

示例4: loadClass

 /**
  * @param string $ClassName
  *
  * @return bool
  */
 public function loadClass($ClassName)
 {
     if ($this->checkExists($ClassName)) {
         return true;
     }
     if (function_exists('apc_fetch')) {
         $Hash = sha1($this->Namespace . $this->Path . $this->Separator . $this->Extension . $this->Prefix);
         // @codeCoverageIgnoreStart
         if (false === ($Result = apc_fetch($Hash . '#' . $ClassName))) {
             $Result = $this->checkCanLoadClass($ClassName);
             apc_store($Hash . '#' . $ClassName, $Result ? 1 : 0);
         }
         if (!$Result) {
             return false;
         }
     } else {
         // @codeCoverageIgnoreEnd
         if (!$this->checkCanLoadClass($ClassName)) {
             return false;
         }
     }
     /** @noinspection PhpIncludeInspection */
     require $this->Path . DIRECTORY_SEPARATOR . trim(str_replace(array($this->Prefix . $this->Separator, $this->Separator), array('', DIRECTORY_SEPARATOR), $ClassName), DIRECTORY_SEPARATOR) . $this->Extension;
     return $this->checkExists($ClassName);
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:30,代码来源:NamespaceLoader.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: __construct

 public function __construct($table, $field, $min, $condition = "", $cacheName = "")
 {
     if (empty($cacheName) || $cacheName == "") {
         $cacheName = $table;
     }
     $this->array = apc_fetch($cacheName, $success);
     if (!$success) {
         echo "{$table} FROM DATABASE";
         if (!empty($condition)) {
             echo $query = "select {$field} from {$table} where {$condition} order by {$field}";
         } else {
             echo $query = "select {$field} from {$table} order by {$field}";
         }
         $result = mysql_query($query) or trigger_error(mysql_error(), E_USER_ERROR);
         if (mysql_num_rows($result)) {
             echo "Sucess";
             $this->array = array();
             while ($row = mysql_fetch_array($result)) {
                 $this->array[] = strtolower($row[$field]);
             }
             apc_store($cacheName, $this->array);
         }
     }
     $this->count = count($this->array);
     $this->min = $min;
 }
开发者ID:superego546,项目名称:SMSGyan,代码行数:26,代码来源:binary_search.php

示例7: profile

 /**
  * Logs the number of milliseconds till this named point.
  */
 public static function profile($point)
 {
     if (!self::$profilingEnabled) {
         return;
     }
     $path = "";
     if (isset($_SERVER['REQUEST_URI'])) {
         $path = $_SERVER['REQUEST_URI'];
     }
     if (strpos($path, 'af_format=json') !== false) {
         $memory = apc_fetch('Console::memory');
         if ($memory !== false) {
             list(self::$startedAt, self::$last) = $memory;
         }
     }
     $now = microtime(true);
     if (self::$startedAt === null) {
         self::$startedAt = $now;
         self::$last = $now;
     }
     $totalMillis = ($now - self::$startedAt) * 1000;
     $passedMillis = ($now - self::$last) * 1000;
     file_put_contents('php://stderr', self::formatPoint($totalMillis, $passedMillis, $point, $path));
     self::$last = $now;
     apc_store('Console::memory', array(self::$startedAt, self::$last));
 }
开发者ID:cbsistem,项目名称:appflower_engine,代码行数:29,代码来源:Console.class.php

示例8: get_sensor_name_list

function get_sensor_name_list () {
	
	$sensor_list = apc_fetch('sensor_list');
	//var_dump($sensor_list);
		
	if (!$sensor_list) // if not available in APC then read the list from DB, then save the list in APC  
		{
			//echo "must read sesnor list from db";  
			
			$static_db = open_static_data_db(true);
			$results = $static_db->query('SELECT * FROM sensor_names;');
			while ($row = $results->fetchArray()) {
				$sensor_id = $row['id'];
				$sensor_name = $row['sensor_name'];
				$sensor_list[$sensor_id] = $sensor_name;
				//var_dump($sensor_list);
				// save the sensor list in APC	
			}
			$static_db->close();
			apc_store('sensor_list', $sensor_list);
	}
	
	return $sensor_list;
	
}
开发者ID:krisjanis-gross,项目名称:remote-pi,代码行数:25,代码来源:sensor_names.php

示例9: getClassPath

function getClassPath()
{
    static $classpath = array();
    if (!empty($classpath)) {
        return $classpath;
    }
    if (function_exists("apc_fetch")) {
        $classpath = apc_fetch("fw:root:autoload:map:1397705849");
        if ($classpath) {
            return $classpath;
        }
        $classpath = getClassMapDef();
        apc_store("fw:root:autoload:map:1397705849", $classpath);
    } else {
        if (function_exists("eaccelerator_get")) {
            $classpath = eaccelerator_get("fw:root:autoload:map:1397705849");
            if ($classpath) {
                return $classpath;
            }
            $classpath = getClassMapDef();
            eaccelerator_put("fw:root:autoload:map:1397705849", $classpath);
        } else {
            $classpath = getClassMapDef();
        }
    }
    return $classpath;
}
开发者ID:sdgdsffdsfff,项目名称:qconf-inner,代码行数:27,代码来源:auto_load.php

示例10: getAcl

 /**
  * Returns the ACL list
  *
  * @return Phalcon\Acl\Adapter\Memory
  */
 public function getAcl()
 {
     // Check if the ACL is already created
     if (is_object($this->acl)) {
         return $this->acl;
     }
     // Check if the ACL is in APC
     if (function_exists('apc_fetch')) {
         $acl = apc_fetch('vokuro-acl');
         if (is_object($acl)) {
             $this->acl = $acl;
             return $acl;
         }
     }
     // Check if the ACL is already generated
     if (!file_exists(APP_DIR . $this->filePath)) {
         $this->acl = $this->rebuild();
         return $this->acl;
     }
     // Get the ACL from the data file
     $data = file_get_contents(APP_DIR . $this->filePath);
     $this->acl = unserialize($data);
     // Store the ACL in APC
     if (function_exists('apc_store')) {
         apc_store('vokuro-acl', $this->acl);
     }
     return $this->acl;
 }
开发者ID:GBraL,项目名称:vokuro,代码行数:33,代码来源:Acl.php

示例11: findFile

 /**
  * Finds a file by class name while caching lookups to APC.
  *
  * @param string $class A class name to resolve to file
  *
  * @return string|null The path, if found
  */
 public function findFile($class)
 {
     if (false === ($file = apc_fetch($this->prefix . $class))) {
         apc_store($this->prefix . $class, $file = parent::findFile($class));
     }
     return $file;
 }
开发者ID:ehough,项目名称:pulsar,代码行数:14,代码来源:ApcUniversalClassLoader.php

示例12: loguear

function loguear($is_cache)
{
    global $link, $original_req, $log_active;
    if ($log_active) {
        $cache_key2 = "IPsLog";
        $cache = apc_fetch($cache_key2, $susses);
        $link_log = $original_req;
        if ($original_req != $link) {
            $link_log = $original_req . " -> " . $link;
        }
        if ($is_cache) {
            $link_log = "(from cache)" . $link_log;
        }
        $add = "(IP: " . $_SERVER['REMOTE_ADDR'] . ") " . $link_log . "\n [header: " . getallheaders() . "]";
        if ($susses) {
            apc_store($cache_key2, $cache . "\n\n" . $add, 1800);
        } else {
            apc_store($cache_key2, $add, 1800);
        }
        $cache_key2 = "IPsLogExcel";
        $cache = apc_fetch($cache_key2, $susses);
        $add = $_SERVER['REMOTE_ADDR'] . "\t" . $original_req . "\t" . $link . "\t" . $_SERVER['HTTP_REFERER'] . "\n";
        if ($susses) {
            apc_store($cache_key2, $cache . $add, 1800);
        } else {
            $add = "IP\tOriginal request\tRequest Procesado\tReferer\n" . $add;
            apc_store($cache_key2, $add, 1800);
        }
    }
}
开发者ID:samirios1,项目名称:niter,代码行数:30,代码来源:player_p2.php

示例13: clean

 /**
  * Clean the cache. If group is specified, clean only the group
  */
 public function clean($group = null, $mode = 'group')
 {
     if (!$this->_caching) {
         return;
     }
     if (!is_null($group)) {
         $tags = apc_fetch('jomsocial-tags');
         if (is_null($tags)) {
             apc_clear_cache('user');
             $tags = array();
         }
         // @todo: for each cache id, we should clear it from other tag list as well
         foreach ($group as $tag) {
             if (!empty($tags[$tag])) {
                 foreach ($tags[$tag] as $id) {
                     apc_delete($id);
                 }
             }
         }
     } else {
         // Clear everything
         apc_clear_cache('user');
     }
     return true;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:28,代码来源:cache.php

示例14: getDurationMillis

function getDurationMillis($filePath)
{
    global $ffprobeBin;
    // try to fetch from cache
    $cacheKey = "duration-{$filePath}";
    $duration = apc_fetch($cacheKey);
    if ($duration) {
        return $duration;
    }
    // execute ffprobe
    $commandLine = "{$ffprobeBin} -i {$filePath} -show_streams -print_format json -v quiet";
    $output = null;
    exec($commandLine, $output);
    // parse the result - take the shortest duration
    $ffmpegResult = json_decode(implode("\n", $output));
    $duration = null;
    foreach ($ffmpegResult->streams as $stream) {
        $curDuration = floor(floatval($stream->duration) * 1000);
        if (is_null($duration) || $curDuration < $duration) {
            $duration = $curDuration;
        }
    }
    // store to cache
    apc_store($cacheKey, $duration);
    return $duration;
}
开发者ID:opshu,项目名称:nginx-vod-module,代码行数:26,代码来源:playlist.php

示例15: get

 public static function get($key)
 {
     global $config, $debug;
     $key = $config['cache']['prefix'] . $key;
     $data = false;
     switch ($config['cache']['enabled']) {
         case 'memcached':
             if (!self::$cache) {
                 self::init();
             }
             $data = self::$cache->get($key);
             break;
         case 'apc':
             $data = apc_fetch($key);
             break;
         case 'xcache':
             $data = xcache_get($key);
             break;
         case 'php':
             $data = isset(self::$cache[$key]) ? self::$cache[$key] : false;
             break;
     }
     // debug
     if ($data && $config['debug']) {
         $debug['cached'][] = $key;
     }
     return $data;
 }
开发者ID:niksfish,项目名称:Tinyboard,代码行数:28,代码来源:cache.php


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