Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

What does ?flush=1 do?


Go to End


4 Posts   1841 Views

Avatar
simples

Community Member, 77 Posts

22 August 2012 at 4:47am

Hi,

When I add the following line

SSViewer::flush_template_cache();

and also when I add the following lines

SSViewer::flush_template_cache();
SS_Cache::set_cache_lifetime('any', -1, 100);
HTTP::set_cache_age(0);

to the top of of [root]/mysite/_config.php

I find that elapse time is significantly less than if I add ?flush=1 to the end of the URL.

What is ?flush=1 doing which the code added to _config.php are not?

Indeed I sometimes find that in order to make changes to my templates show when I browse the page I have to resort to adding

?flush=1

to the end of the URL regardless of what code I have added to _config.php. This is a real pain and I would like to avoid having to keep doing this whenever I change a template.

Obviously the above refers to flushing the cache when serving page content. Browser cache may be playing a part here as well. Regarding browser cache, this reduced elapse time which I noticed when I relied on code added to _config.php not only happens when I browse the page using Google Chrome but also when I use IE with the browser set up so that page content is refreshed every time a page is browsed. I think this rules out the part played by the browser cache and points the finger at what is happening when page content is being served.

If anyone could point out to me what ?flush=1 may be doing different to SSViewer::flush_template_cache() and how I may avoid having to keep adding ?flush=1 to the end of the URL, that would be great.

Thanks.

Avatar
simples

Community Member, 77 Posts

22 August 2012 at 5:08am

Edited: 22/08/2012 5:08am

Ok, I may be speaking too soon, but adding the following line to _config.php may be doing something along the right lines

unlink(TEMP_FOLDER.'/manifest-main');

Avatar
swaiba

Forum Moderator, 1899 Posts

22 August 2012 at 5:17am

Avatar
simples

Community Member, 77 Posts

22 August 2012 at 5:46am

Thanks swaiba. This helps to fill in the picture.