Viewing 15 replies - 1 through 15 (of 19 total)
  • Thread Starter limeybloke

    (@limeybloke)

    Just to clarify this, I have a static front page for my site. When I add a new Post the front page is flushed and it appears all other pages in the site as well.

    I’m using the Varnish VCL to linked to from Dreamhosts.

    I’ve tested this as I’ve got a page in my site that has a support panel listing all the latest blog posts. When I add a new post this is flushed as well.

    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    No, it should only flush the pages that are changed, and the front page. That includes tags and categories, mind you, so if you always use the same ones, they will get caught.

    How are you determining that the whole cache is flushed? Also what version of varnish are you on?

    Thread Starter limeybloke

    (@limeybloke)

    Hi there,

    So I’m using Varnish 3.0.5

    The pages I’m looking at have no relation to tags or categories which is why I’m puzzled.

    If you visit this page https://www.nlg.nhs.uk/hospitals/grimsby/getting-here/ you’ll see in the side bar, we have a panel that pulls in the latest blog posts. This page here is simply a Page. I’m expecting this page to be cached and when I update the blog my side panel would become out-of-date as I’m not using EIS.

    If I then go in and add a new blog post. I’m expecting the front page (which is https://www.nlg.nhs.uk/news/) to be flushed but not the other page and it’s totally independant.

    What happens is the Getting here page is also flushed and my side panel updated.

    I ran a few tests where I disabled the plugin and made a few random changes to other content pages. Then switched the plugin back on and added a new Post and and new changes are there. Which means when I add a new Post it is clearing all cache.

    Based on what you’ve described this shouldn’t be happening – right?

    The side panel is using the following code;

    <?php
        $queryObject = new WP_Query( 'post_type=post&posts_per_page=3' );
        // The Loop!
        if ($queryObject->have_posts()) {
          while ($queryObject->have_posts()) {
            $queryObject->the_post(); ?>
            <article class="side-feed__item" role="article">
              <h3 class="item__heading"><i class="icon--chevron icon--inset"></i><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
              <div class="item__copy"><?php the_excerpt(); ?></div>
              <p class="item__meta">Posted <time datetime="<?php echo get_the_date('Y-m-d'); ?>"><?php echo get_the_date('d/m/Y'); ?></time></p>
            </article>
        <?php
    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Do you have access to the varnish logs and if so, can you see what command is being sent to it when you post a page?

    Thread Starter limeybloke

    (@limeybloke)

    Yes I do but not entirely sure how to access them or to check what is being passed?

    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    When I get to a real computer tomorrow, I’ll reply with directions on how to and what we’re looking for. I’m on an iPad right now and can’t get at my notes ??

    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    OKAY! So yesterday sucked.

    varnishncsa -F "%m %U"

    On our servers at DreamHost we run that to watch every process as it goes through.

    If you run that you’ll see things like this:

    GET /wp-content/uploads/2013/09/1user_00.png
    GET /wp-content/uploads/2013/09/1user_01.png
    GET /wp-content/uploads/2013/09/geico-caveman-commercial-scrabble-i14-300x288.jpg

    And what you’re looking for when you save a page is this:

    POST /wp-admin/admin-ajax.php
    GET /wp-includes/images/smilies/icon_wink.gif
    PURGE /category/intermediate/
    PURGE /tag/dreamhost/
    PURGE /tag/security/
    PURGE /tag/users/
    PURGE /tag/wordpress/
    PURGE /separate-users-are-good/
    PURGE /feed/rdf/
    PURGE /feed/rss/
    PURGE /feed/
    PURGE /feed/atom/
    PURGE /comments/feed/atom/
    PURGE /comments/feed/
    PURGE /separate-users-are-good/feed/
    PURGE /
    POST /wp-admin/post.php

    So that tells me everything I’m purging.

    If you see this:

    GET /wp-admin/
    PURGE /.*
    GET /wp-admin/

    It means the whole SITE was purged.

    Thread Starter limeybloke

    (@limeybloke)

    Morning and thanks for helping!

    So I posted a new Post and I got this.

    POST /wordpress/wp-admin/admin-ajax.php
    POST /wordpress/wp-admin/admin-ajax.php
    POST /wordpress/wp-admin/admin-ajax.php
    PURGE /category/announcements/
    PURGE /news/new-1-2/
    PURGE /feed/rdf/
    PURGE /feed/rss/
    PURGE /feed/
    PURGE /feed/atom/
    PURGE /comments/feed/atom/
    PURGE /comments/feed/
    PURGE /news/new-1-2/feed/
    PURGE /
    Thread Starter limeybloke

    (@limeybloke)

    I pressed the “Purge” button on the dashboard and got this;

    GET /wordpress/wp-admin/index.php
    PURGE /.*

    Thread Starter limeybloke

    (@limeybloke)

    This is very weird. I’ve just run a few more tests.

    I switched off the plugin.
    Made a change to a content page that doesn’t have the side panel on.
    Switched the plugin back on.
    Posted a new post.
    And checked that page and the amend was now visible.

    So it’s telling me the cache is being cleared each and every time a new post is posted.

    I’ve also noticed that if I delete a post it’s not clearing the the side panel but is clearing everything else (i.e. the news home page etc).

    So when I deleted the post, my side panel is out of date which is what I would expect.

    The delete post resulted in;

    POST /wordpress/wp-admin/admin-ajax.php
    PURGE /category/awards/
    PURGE /news/new-3/
    PURGE /feed/rdf/
    PURGE /feed/rss/
    PURGE /feed/
    PURGE /feed/atom/
    PURGE /comments/feed/atom/
    PURGE /comments/feed/
    PURGE /news/new-3/feed/
    PURGE /
    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Clearing the news page (ie the front page) is what I expect, it’s a default page to flush… So yeah, it looks like the plugin is doing exactly what it’s supposed to do.

    Are you perchance always logged in when you’re looking? Varnish in general skips the cache when you’re logged in.

    Thread Starter limeybloke

    (@limeybloke)

    Hi Mike,

    But it’s not the front page that’s being cleared here. That is as well.

    So when I post all pages are cleared.

    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Unless THIS hits your log, you’re not seeing all posts being cleared:

    PURGE /.*

    Or rather, it’s not the plugin…

    The ONLY reason it might happen is if you set up Varnish so that this

    PURGE /

    meant to purge everything. And that’s something you would have had to do on your vcl config, and I don’t even know how to :/

    Thread Starter limeybloke

    (@limeybloke)

    I was using the Dreamhost VCL for purging seen here

    https://github.com/dreamhost/varnish-vcl-collection/blob/master/lib/purge.vcl

    Note there appears to be some reference to /

    Could this be the problem?

    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    PURGE / literally means ‘Purge domain.com/’

    The whole reason that PURGE /.* means to use regular expressions and purge everything

    Sadly, I’m not enough of a varnish vlc expert to know why your install is treating / as a full domain purge, but I suspect that’s what’s happening.

    What version of Varnish are you on? Did you enable regex on it? (there’s more than JUST the vcl to controlling varnish after all)

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Purge on new Posts in clearing all cache’ is closed to new replies.