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 7491833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:10:57+00:00 2026-05-29T16:10:57+00:00

I wanted to cache controller ajax <?php class Default_Bootstrap extends Zend_Application_Module_Bootstrap { public function

  • 0

I wanted to cache controller ajax

<?php
class Default_Bootstrap extends Zend_Application_Module_Bootstrap
{
    public function _initCache()
    {
        $frontendOptions = array(
            'lifetime' => 10800,
            'automatic_serialization' => true,
            'debug_header' => false,
            'regexps' => array('^/ajax/' => array('cache' => true),
                               '^/admin/' => array('cache' => false)),
            'default_options' => array(
            'cache_with_cookie_variables' => true,
            'make_id_with_cookie_variables' => false));

        $backendOptions = array('cache_dir' => APPLICATION_PATH.'/data/cache');
        $cache = Zend_Cache::factory('Page','File',$frontendOptions,$backendOptions);

        $cache->start();
    }
}

But caching the entire site, including the admin module.

  • 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-29T16:10:58+00:00Added an answer on May 29, 2026 at 4:10 pm

    Use debug_header to true and check , the code below. As we set not to cache all pages at first, and only to cache the page starting with ajax , I hope all the ajax pages starts with the name ajax else change accordingly the regexp.

    class Default_Bootstrap extends Zend_Application_Module_Bootstrap
    {
        public function _initCache()
        {
            $frontendOptions = array(
                'lifetime' => 10800,
                'automatic_serialization' => true,
                'debug_header' => true,                
                'regexps' => array(
                    '$' => array('cache' => false),
                    '/ajax' => array('cache' => true),
                ),
                'default_options' => array(
                    'cache_with_cookie_variables' => true,
                    'make_id_with_cookie_variables' => false
                )
            );
    
            $backendOptions = array('cache_dir' => APPLICATION_PATH.'/data/cache');
            $cache = Zend_Cache::factory('Page','File',$frontendOptions,$backendOptions);
    
            $cache->start();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For fun, I'm playing with a class to easily cache function results. The basic
Can I Implement Caching in MVC, If so how? I wanted to implement Cache
I'm making an in webpage cache system. I wanted to make a simple page
I wanted to access the thumb cache of vista and 7 to be used
I wanted to know whether malloc/new returns memory blocks from Cache or RAM. Thanks
I'm new to PHP and Zend, and I would like to cache sensitive data
I'm running a cronjob which needs to write data to a cache. I wanted
Wanted to know if the Accessor methods of Enterprise Library 5.0 cache the fields
I wanted to ask you what is the best approach to implement a cache
I wanted to try the Spring 3.1 Cache Abstraction, annotating some methods with @Cachable.

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.