Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6820835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:28:20+00:00 2026-05-26T21:28:20+00:00

Good day, I have run into some problem in the Zend_Cache_Frontend_Page. I want to

  • 0

Good day,

I have run into some problem in the Zend_Cache_Frontend_Page. I want to use Zend_Cache_Frontend_Page to caching some of pages. But it does not work.

protected function _initBookPageCaching()
{
    Zend_Controller_Front::getInstance()->setParam('disableOutputBuffering',true);      
    // cache book pages
    $frontendOptionsPages = array(
       'lifetime' => 2592000,
       'debug_header' => true, // for debugging
       'regexps' => array(
           // cache the whole IndexController
           '^/$' => array('cache' => true),
           '^/download-free-ebook/.*' => array('cache' => true)
       )
    );

    $backendOptionsPages = array(
        'cache_dir' =>  APPLICATION_PATH.'/../cache'
    );

    $cacheBookPages = Zend_Cache::factory(
                         'Page',
                         'File',
                         $frontendOptionsPages,
                         $backendOptionsPages);

    $cacheBookPages->start();
}

i set above method into Bootstrap.php file.

Please help me solve this problem.

Thanks for advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:28:21+00:00Added an answer on May 26, 2026 at 9:28 pm

    I never actually use Zend_Controller_Front::getInstance() in my bootstrap, rather I use:

    $this->bootstrap('frontController');
    

    followed by:

    $front = $this->getResource('frontController');
    

    with which you could try:

    $front->setParam('disableOutputBuffering', true);
    

    Also, I’m not sure what the acceptable regex’s are for controllers and what not. Maybe try changing '^/download-free-ebook/.*' to '^/download-free-ebook/'. And see if just the index action for that controller at least caches.

    EDIT:
    I found the issue. $cache->start(); is returning false so I did some debugging. You’re not passing a cache id (e.g. $cacheBookPages->start('some_cache_id');) so Zend_Cache_Frontend_Page attempts to make one for you on line 261. like so:

    // from Zend/Cache/Frontend/Page.php
    public function start($id = false, $doNotDie = false)
    {
        // ....
        if (!$id) {
            $id = $this->_makeId();
            if (!$id) {
                return false;
            }
        }
        // ....
    }
    

    So after following the rabbit trail, I realized that it was trying to build a cache id based off the following arrays: $_GET, $_POST, $_SESSION, $_COOKIE and $_FILES. Since none of those are set it is unable to create a cache id! And since it can’t create a cache id, it can’t create the cache file.

    Solution:

    $uri      = explode('/', $_SERVER['REQUEST_URI']);
    $cacheKey = array();
    foreach ($uri as $key) {
        if (empty($key)) {
            continue 1;
        }
        $cacheKey[] = $key;
    }
    
    $cacheBookPages->start('page_cache_' . implode('_', $cacheKey));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good day, to stackoverflow community. I have run into a bug with regard to
Good day! I have strange problem with Xcode 4.3. When I'm trying to run
Good day, I'm not sure if this is possible but I want to merge
Good day, I have one theoretical question. I have an application that run some
Good day all I have the following question: I would like to use Chart
Good day everyone. I have an audio class, that plays a .wav file. But
Good day! I have met problem with synchronizing threads. I am writing program which
Good day everyone, so here, I have a problem with my repeater control's SQL
a day before end of project i run into a complicated issue: i have
Good day, i have very strange problem with my rails development setup: RVM, latest

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.