Roshan Wijesena
Roshan Wijesena

Reputation: 3136

Symfony pages loading from cache

Im working on symfony project i got strange problem in production envirment. when i load the page it always getting to cache any dynamic data are not loading to the page. when i clear the cache browser its getting fixed data display correctly

my configuration in symfony config files cache false my application currently hosted in cloud envirment

My symfony config file cache.yml settings here

  default:
      enabled:     off
      with_layout: false
      lifetime:    86400

Upvotes: 1

Views: 726

Answers (2)

Roshan Wijesena
Roshan Wijesena

Reputation: 3136

simple Solution is

header("Cache-Control: no-store, no-cache, must-revalidate"); 

put it your symfony web/index.php top

Upvotes: 0

tttony
tttony

Reputation: 5082

From the Symfony guide

Global Cache Settings

For each application of a project, the HTML cache mechanism can be enabled or disabled (the default), per environment, in the cache setting of the settings.yml file. Listing 12-1 demonstrates enabling the cache.

Listing 12-1 - Activating the Cache, in frontend/config/settings.yml

prod:
  .settings:
    cache:                  off

Upvotes: 1

Related Questions