Zend Page Cache not working
Posted: Mon Nov 23, 2009 2:20 pm
I'm confused about the results that I am getting with Zend Page Cache. It appears that the cache is not used when I load the page in FireFox or another webbrowser, but that it is used when I test the page on the command line with Apache Bench. Here is the code that I am using:
Now, my understanding is that when I load this script in my browser it should save the page contents (the current timestamp) and then output that initial timestamp for the next 7200 seconds. However, when I load this sample page in FireFox or Safari, it displays a new timestamp each time and nothing is saved in the ./tmp/ directory. However, when I run apache bench like this: Zend Cache files suddenly appear in the ./tmp/ directory, and speed tests seem to confirm that ab is using the cached version. Even after this file is saved by runing ab, the browser still seems to avoided loading the cached version.
Can someone help me figure out what is going on?
Code: Select all
<?php
include 'Zend/Cache.php';
$frontendOptions = array(
'lifetime' => 7200,
'automatic_serialization' => false,
'default_options' => array(
'cache' => true
)
);
$backendOptions = array(
'cache_dir' => './tmp/'
);
$cache = Zend_Cache::factory('Page', 'File', $frontendOptions, $backendOptions);
$cache->start();
echo time();Now, my understanding is that when I load this script in my browser it should save the page contents (the current timestamp) and then output that initial timestamp for the next 7200 seconds. However, when I load this sample page in FireFox or Safari, it displays a new timestamp each time and nothing is saved in the ./tmp/ directory. However, when I run apache bench like this:
Code: Select all
ab -n 1000 -c 100 http://wire.dev/cachetest.phpCan someone help me figure out what is going on?