debug zend cache

For programming and general questions on Zend Framework
Post Reply
jack000
Posts: 2
Joined: Thu Mar 25, 2010 7:46 am

debug zend cache

Post by jack000 » Thu Mar 25, 2010 8:09 am

I was using zend cache in my public index.php file just like in the docs:

Code: Select all

<?php

// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../partkart'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../partkartlib'),
    get_include_path(),
)));

require_once 'Zend/Cache.php';

	// see if requested page is in cache

	$frontendOptions = array(
	   'lifetime' => 7200, // 2 hours
	   'debug_header' => true, // for debugging
	   
		// Disable caching by default for all URLs
		//'default_options' => array('cache' => false),
	   'regexps' => array(

		// cache the whole IndexController
		'^/$' => array('cache' => true),

		// cache the whole IndexController
		'^/index/' => array('cache' => true),
		
		// cache the whole StaticController
		'^/static/' => array('cache' => true)
		)
	);

	$backendOptions = array(
		'cache_dir' => '../partkartcache'
	);

	// getting a Zend_Cache_Frontend_Page object
	$cache = Zend_Cache::factory('Page',
								 'File',
								 $frontendOptions, $backendOptions);
	$cache->start();
This worked perfectly. Then I disabled it and continued to work on other parts of the code. Now when I re-enable caching, the cache misses every time, no cache files are generated, and the debug header is never displayed. I've tried everything, from changing the cache directory permissions to reinstalling apache/php to doing a complete system restore, and I'm just out of ideas... I suspect it's a windows permissions problem, but I don't know why the cache is failing silently (it should give an error at least if it couldn't write to the cache?). It does complain if the cache directory doesn't exist. How do I find out why the cache is not working? Everything else is working fine.

I'm working on windows 7 64bit with wamp server.

jack000
Posts: 2
Joined: Thu Mar 25, 2010 7:46 am

Re: debug zend cache

Post by jack000 » Thu Mar 25, 2010 8:23 am

also, the cache files are generated when I use a load testing tool instead of a browser. I'm not sure what this means...

mmmshuddup
Posts: 28
Joined: Fri Oct 22, 2010 6:44 am

Re: debug zend cache

Post by mmmshuddup » Wed Nov 09, 2011 10:41 pm

I'm seeing someone with a similar issue on stack overflow. You may want to move your issue over there as it appears nobody on these forums ever really respond to issues. This has happened to me a lot too. Don't get me wrong, I love Zend and their products and all but just not their forums. The forums are pretty much useless.

Post Reply