$bar = 'BAR';
apc_add('foo', $bar);
var_dump(apc_fetch('foo'));
echo "\n";
$bar = 'NEVER GETS SET';
apc_add('foo', $bar);
var_dump(apc_fetch('foo'));
echo "\n";
Bye.
whisher wrote:
>
> <p>Hi Pieter,</p>
> <p>Next time I'll clicking 'reply all' I swear to you :)</p>
> <p>so the nitty-gritty</p>
> <p>I've run the apc.php on the server </p>
> <h2>General Cache Information</h2>
> <table cellspacing="0"><tbody>
> <tr class="tr-0"><td class="td-0">APC Version</td><td>3.0.19</td></tr>
> <tr class="tr-1"><td class="td-0">PHP
> Version</td><td>5.2.6-1+lenny4</td></tr><tr class="tr-0"><td
> class="td-0">APC Host</td><td>xxxxxxx (xxxxx) (92.xxxxx)</td></tr>
> <tr class="tr-1"><td class="td-0">Server Software</td><td>Apache/2.2.9
> (Debian)</td></tr>
>
> <tr class="tr-0"><td class="td-0">Shared Memory</td><td>1 Segment(s)
> with 30.0 MBytes
> <br> (mmap memory, pthread mutex locking)
> </td></tr><tr class="tr-1"><td class="td-0">Start
> Time</td><td>2009/12/22 19:49:05</td></tr><tr class="tr-0"><td
> class="td-0">Uptime</td><td> 0 minutes</td></tr><tr class="tr-1"><td
> class="td-0">File Upload Support</td><td>1</td></tr> </tbody></table>
> </div>
>
> <div class="info div1"><h2>File Cache Information</h2>
> <table cellspacing="0"><tbody>
> <tr class="tr-0"><td class="td-0">Cached Files</td><td>1 (288.3
> KBytes)</td></tr>
> <tr class="tr-1"><td class="td-0">Hits</td><td>1</td></tr>
> <tr class="tr-0"><td class="td-0">Misses</td><td>1</td></tr>
>
> <tr class="tr-1"><td class="td-0">Request Rate (hits,
> misses)</td><td>2.00 cache requests/second</td></tr>
> <tr class="tr-0"><td class="td-0">Hit Rate</td><td>1.00 cache
> requests/second</td></tr>
> <tr class="tr-1"><td class="td-0">Miss Rate</td><td>1.00 cache
> requests/second</td></tr>
> <tr class="tr-0"><td class="td-0">Insert Rate</td><td>1.00 cache
> requests/second</td></tr>
> <tr class="tr-1"><td class="td-0">Cache full count</td><td>0</td></tr>
>
> </tbody></table>
> </div>
>
> <div class="info div1"><h2>User Cache Information</h2>
> <table cellspacing="0"><tbody>
> <tr class="tr-0"><td class="td-0">Cached Variables</td><td>0 ( 0.0
> Bytes)</td></tr>
> <tr class="tr-1"><td class="td-0">Hits</td><td>0</td></tr>
>
> <tr class="tr-0"><td class="td-0">Misses</td><td>0</td></tr>
> <tr class="tr-1"><td class="td-0">Request Rate (hits,
> misses)</td><td>0.00 cache requests/second</td></tr>
> <tr class="tr-0"><td class="td-0">Hit Rate</td><td>0.00 cache
> requests/second</td></tr>
> <tr class="tr-1"><td class="td-0">Miss Rate</td><td>0.00 cache
> requests/second</td></tr>
> <tr class="tr-0"><td class="td-0">Insert Rate</td><td>0.00 cache
> requests/second</td></tr>
>
> <tr class="tr-1"><td class="td-0">Cache full count</td><td>0</td></tr>
>
> </tbody></table>
> <h2>Runtime Settings</h2><table cellspacing="0"><tbody><tr
> class="tr-0"><td class="td-0">apc.cache_by_default</td><td>1</td></tr>
> <tr class="tr-1"><td class="td-0">apc.coredump_unmap</td><td>0</td></tr>
>
> <tr class="tr-0"><td class="td-0">apc.enable_cli</td><td>0</td></tr>
> <tr class="tr-1"><td class="td-0">apc.enabled</td><td>1</td></tr>
> <tr class="tr-0"><td
> class="td-0">apc.file_update_protection</td><td>2</td></tr>
> <tr class="tr-1"><td class="td-0">apc.filters</td><td></td></tr>
> <tr class="tr-0"><td class="td-0">apc.gc_ttl</td><td>3600</td></tr>
> <tr class="tr-1"><td
> class="td-0">apc.include_once_override</td><td>0</td></tr>
>
> <tr class="tr-0"><td class="td-0">apc.max_file_size</td><td>1M</td></tr>
> <tr class="tr-1"><td class="td-0">apc.mmap_file_mask</td><td></td></tr>
> <tr class="tr-0"><td
> class="td-0">apc.num_files_hint</td><td>1000</td></tr>
> <tr class="tr-1"><td
> class="td-0">apc.report_autofilter</td><td>0</td></tr>
> <tr class="tr-0"><td class="td-0">apc.rfc1867</td><td>0</td></tr>
> <tr class="tr-1"><td class="td-0">apc.rfc1867_freq</td><td>0</td></tr>
>
> <tr class="tr-0"><td
> class="td-0">apc.rfc1867_name</td><td>APC_UPLOAD_PROGRESS</td></tr>
> <tr class="tr-1"><td
> class="td-0">apc.rfc1867_prefix</td><td>upload_</td></tr>
> <tr class="tr-0"><td class="td-0">apc.shm_segments</td><td>1</td></tr>
> <tr class="tr-1"><td class="td-0">apc.shm_size</td><td>30</td></tr>
> <tr class="tr-0"><td class="td-0">apc.slam_defense</td><td>0</td></tr>
> <tr class="tr-1"><td class="td-0">apc.stat</td><td>1</td></tr>
>
> <tr class="tr-0"><td class="td-0">apc.stat_ctime</td><td>0</td></tr>
> <tr class="tr-1"><td class="td-0">apc.ttl</td><td>0</td></tr>
> <tr class="tr-0"><td
> class="td-0">apc.user_entries_hint</td><td>4096</td></tr>
> <tr class="tr-1"><td class="td-0">apc.user_ttl</td><td>0</td></tr>
> <tr class="tr-0"><td class="td-0">apc.write_lock</td><td>1</td></tr>
> </tbody></table>
>
>
>
> <p>It seems that APC caching is enabled, doesn't it ?</p>
> <p>I never used APC so I don't know which way to turn.
> Regards.
> Whisher
>
>
> Pieter Kokx wrote:
>>
>> Are you sure that APC caching is enabled? Does APC caching without
>> Zend_Cache work (like described in http://php.net/apc )?
>>
>> And next time, would you bother clicking on 'reply all', so the mailing
>> list is also added?
>>
>> --
>> Best Regards,
>>
>> Pieter Kokx
>> PHP Developer
>> Zend Framework developer
>>
>>
>>
>> whisher@mp4.it schreef:
>>> Hi Pieter,
>>> Well actually it doesn't cache anything :(
>>> if I use Apc while it works (do cache)
>>> with File.
>>> Regards,
>>> Bye.
>>>
>>>
>>> --- Messaggio originale ---
>>> Hi,
>>>
>>> How exactly do you mean with 'this doesn't work'? Doesn't it cache
>>> anything or what?
>>>
>>> Regards,
>>>
>>> Pieter Kokx
>>> PHP Developer
>>> Zend Framework developer
>>>
>>>
>>>
>>> whisher schreef:
>>> > Hi.
>>> > I don't understand why this works with File
>>> > doesn't work with with Apc
>>> > protected function _initCache()
>>> > {
>>> > $dir = Zend_Registry::get('dir');
>>> > $frontendOptions = array(
>>> > 'caching'=> true,
>>> > 'cache_id_prefix' => null,
>>> > 'lifetime' => 7200,
>>> > 'logging' => false,
>>> > 'write_control'=> true,
>>> > 'automatic_serialization' => true,
>>> > 'automatic_cleaning_factor' => 10,
>>> > 'ignore_user_abort'=> false,
>>> > );
>>> > $backendOptions = array(
>>> > 'cache_dir' => $dir->cache
>>> > );
>>> > $cache = Zend_Cache::factory('Core', 'File', $frontendOptions,
>>> > $backendOptions);
>>> > //$cache = Zend_Cache::factory('Core', 'Apc', $frontendOptions);
>>> > Zend_Registry::set('cache', $cache);
>>> >
>>> > }
>>> >
>>> > In the model
>>> > public function fetchItems($lang)
>>> > {
>>> > $cache = Zend_Registry::get('cache');
>>> > if(!$data = $cache->load('RightFetchTags')) {
>>> > // do select
>>> > $data = $table->fetchAll($select)->toArray();
>>> > $cache->save($data, 'RightFetchTags');
>>> > }
>>> > return $data;
>>> > }
>>> >
>>> > Bye
>>> >
>>>
>>>
>>>
>>>
>>> --- Dada Music Movement <http://www.dada.it />, tutta la musica che
>>> vuoi! ---
>>
>>
>
>
--
View this message in context: http://n4.nabble.com/Zend-Cache-Apc-troubles-tp976493p977758.html
Sent from the Zend MVC mailing list archive at Nabble.com.
没有评论:
发表评论