日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

php缓存变量_PHP 从缓存中取出存储的变量

發布時間:2025/3/21 php 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php缓存变量_PHP 从缓存中取出存储的变量 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

用戶評論:

Mahn (2012-09-26 18:30:24)

Make?sure?to?check?the?return?value?using?a?strict?comparison?if?you?want?to?know?whether?apc_fetch?failed?unless?you?want?anything?stored?that?can?be?evaluated?to?false?to?report?an?error?aswell.

E.g.?the?following?is?bad:

$result=apc_fetch("key");

if(!$result)?{//handle?error}?>

If?key?is?an?empty?array?or?the?value?0,?it?will?naturally?evaluate?to?false?and?trigger?the?error.?To?avoid?this,?do?instead:

$result=apc_fetch("key");

if($result===false)?{//handle?error}?>

Side?note:?avoid?storing?booleans?in?APC?:)

zim32 at ukr dot net (2012-07-20 23:03:38)

I?dont?know?is?it?a?bug?or?feature?but...

After?apc_fetch?and/or?apc_store?arrays?loose?their?cursor

$array=?array('foo',2,3,4,5);var_dump(current($array));//fooapc_store('foo',$array);$array2=apc_fetch('foo');var_dump(current($array2));//false?>

Anonymous (2011-10-30 23:15:34)

Note?that?the?APC?cache?accessible?from?PHP?running?through?Apache?is?not?accessible?from?CLI-PHP?(the?commandline?PHP?version).?They?are?2?different?APC?caches.

If?you?are?trying?for?example?to?run?a?script?from?cron?that?needs?to?access?the?same?APC?cache?as?your?scripts?(executed?through?Apache)?with?PHP?CLI,?use?file_get_contents?to?execute?the?real?script?or?to?send?over?the?data.

Doing?so?executes?the?script?on?Apache.

You?can?also?specify?a?return?value?in?order?to?move?data?around.

file_get_contents('http://localhost/actual_processing_script.php');?>

myfirstnameattimronayne.com (2010-05-18 05:46:30)

Another reason you might be getting null back from apc_fetch when using apc.rfc1867 is if you have only turned this option on using php_admin_value for a virtual host. It needs to be turned on globally in php.ini to work.

chris at active9 dot com (2009-07-07 00:00:15)

Anyone who has enabled apc.rfc1867 for a file upload progress bar. Please note that if you are not getting any results back or a Null() data set. Then set apc.rfc1867_freq to 10k or 100k or whatever you see fit like this.

apc.rfc1867_freq = 10k

In your php.ini.

Hope this helps some of you who were getting blank data results. It seems the 0 default setting will not work on some machines. Hope this helps!

marcus at synchromedia dot co dot uk (2008-05-03 09:54:30)

Just?to?clarify?the?multi-get?capability,?the?result?is?returned?as?an?array?with?cache?keys?as?the?array?keys.?Any?missing?values?re?not?returned,?for?example:

apc_delete('test1');apc_delete('test2');apc_add('test1','test1');$cached=apc_fetch(array('test1','test2'));var_dump($cached);?>

gives

array(1)?{

["test1"]=>

string(5)?"test1"

}

If?no?keys?are?found,?you?get?an?empty?array.

nospam dot list at unclassified dot de (2007-11-20 15:06:35)

This function is often cited related to file upload tracking with PHP 5.2. So I thought this is a good place to put a warning.

If you setup PHP with FastCGI, you'll probably run into trouble using this function to get any information about a running upload. At least in my case, every HTTP request is handled by a different PHP process. I could track it with the getmypid() function, which returned a different value upon every request, but only from a limited set. Also, apc_cache_info() gave me all upload_* entries that were created in that process. So when the upload was initially catched by one PHP process, all progress updates must be fetched from the same process, too, because APC cache information does not seem to be shared across multiple processes handling that domain/virtual host. But that's impossible to tell because PHP has its own load management and serves every request by an arbitrary process.

So in short: When using FastCGI and multiple PHP processes (recommended for performance reasons), you cannot use APC upload tracking. You'll only get a status update every few requests.

thijsterlouw at gmail dot com_remove_this (2007-02-28 01:31:27)

As?of?version?3.0.13?APC?(released?2007-02-24)?you?can?perform?multiple?key?fetches?with?apc_fetch.?Very?useful?to?further?optimize?your?application!

APC?changelog:

http://pecl.php.net/package-changelog.php?package=APC

example:

apc_store('key1','value1');apc_store('key2','value2');$keys=?array('key1','key2');$result=apc_fetch($keys);//fetch?multiple?keys?at?once!var_dump($result);?>

總結

以上是生活随笔為你收集整理的php缓存变量_PHP 从缓存中取出存储的变量的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。