Jump to:

22977 Posts in 11806 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » What does ?flush=1 do?

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

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

Page: 1
Go to End
Author Topic: 524 Views
  • simples
    Avatar
    Community Member
    76 Posts

    What does ?flush=1 do? Link to this post

    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.

  • simples
    Avatar
    Community Member
    76 Posts

    Re: What does ?flush=1 do? Link to this post

    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');

  • swaiba
    Avatar
    Forum Moderator
    1769 Posts
  • simples
    Avatar
    Community Member
    76 Posts

    Re: What does ?flush=1 do? Link to this post

    Thanks swaiba. This helps to fill in the picture.

    524 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.