Zend Framework

Page cache doesn't work from the controller.

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.9.7
  • Fix Version/s: 1.10.1
  • Component/s: Zend_Cache
  • Labels:
    None

Description

I have initialized the page cache in the controller's action method.
Not sure if it's a wrong place to create and start the page cache,
but the result is that empty page is cached and after first attempt
the page becomes empty.

I did some debugging and it looks like the problem comes from the point that the cache's _flush method is called and the data is cached at wrong time when the buffer is already cleared up with the ViewRenderer action helper in its render method, there the ob_start and ob_end_clean are called, which I think causes the problem.

Activity

Hide
Aram Mkhitaryan added a comment -

After some debugging I found that the Page cache was not working because of the output buffering in the frontcontroller.
If I set the ini parameter
resources.frontcontroller.params.disableOutputBuffering=true
to disable the output buffering, everything works fine.

Is this the correct behaviour? Or is this still an issue that will be fixed?

Show
Aram Mkhitaryan added a comment - After some debugging I found that the Page cache was not working because of the output buffering in the frontcontroller. If I set the ini parameter resources.frontcontroller.params.disableOutputBuffering=true to disable the output buffering, everything works fine. Is this the correct behaviour? Or is this still an issue that will be fixed?
Hide
Pádraic Brady added a comment -

Hi Aram,

It's the correct behaviour but was never documented. I'll update the documentation now to clarify this (it puzzled me too for a while ). But yes, we need to disable the output buffering performed when dispatching the request. On the other hand, it doesn't seem to do an awful lot anyway so its harmless to disable.

Show
Pádraic Brady added a comment - Hi Aram, It's the correct behaviour but was never documented. I'll update the documentation now to clarify this (it puzzled me too for a while ). But yes, we need to disable the output buffering performed when dispatching the request. On the other hand, it doesn't seem to do an awful lot anyway so its harmless to disable.
Hide
Pádraic Brady added a comment -

Note added to documentation in r20712

Show
Pádraic Brady added a comment - Note added to documentation in r20712

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: