Support » Plugin: Cache Enabler » Suggest for Cache Refreshing

  • Resolved HisKingdomProphecy

    (@hiskingdomprophecy)


    @corey

    Things are working well here, but I have a question….. and suggestion.

    Background:

    Our readers access 2-3+K different posts per day and I add about 10-14 new posts per day.
    Our peak times are 8-12 midnight, so I have the cache set for 12 hrs and refresh at 4 am/pm, our quiet times. At noon, our cache was 550-600Mb.

    The cache does not clear except for the 12 hourly refresh and that seems to work fine regarding posts edits etc.

    However, I now see on newish posts that the <<past>><<next>> post navigation only show the name of the previous post, and it is not updating to show the next post.
    See: https://www.hiskingdomprophecy.com/wp-content/uploads/2021/06/HKP-1.jpg

    If I clear the cache on that post, then it will show the next available post.
    See: https://www.hiskingdomprophecy.com/wp-content/uploads/2021/06/HKP-2.jpg

    This is the same on both desktop and mobile screens and I guess this all shows Cache Enabler is working as designed.

    Question:

    I was wondering if it is worth considering having the post navigation data for recent posts to be left uncached, like the front page, so that it will work for all the posts put up since the cache was last refreshed?

    I used to have the cache set for 1-2 hours, so this issue was only visible when I was very busy, but now at 12 hours…. It seems to defeat the purpose of the post navigation and breadcrumbs provisions altogether. 🙂

    Suggestion:

    After further thought….

    Is it possible that when a post is saved, the cache of the previous post is renewed automatically too on the fly, at the same time as the save?

    That would mean that all posts have the correct navigation data, without a total refreshing of the cache.

    That would allow me to serve the readers of new posts with full navigation data, and those of older posts, with a larger cache.

    Regards and thanks,
    Angus

Viewing 6 replies - 1 through 6 (of 6 total)
  • We’re happy to hear that, Angus.

    I was wondering if it is worth considering having the post navigation data for recent posts to be left uncached, like the front page, so that it will work for all the posts put up since the cache was last refreshed?

    It’s not possible for Cache Enabler to only partially cache a page. We take all the page data that is going to be sent to the browser by WordPress and store it in a static HTML file. This data is then retrieved and delivered instead of having WordPress generate it again. A cached page can be updated after retrieved and returned to the browser, but this would have to be through a different solution like JavaScript. It’s not the right solution for what you’re experiencing here.

    If your navigation is built based on the post date order then you can extend Cache Enabler to clear the page cache of the previous post. This can be seen as extending the associated cache that needs to be cleared. In this case only for the post post type instead of any published post type. Try adding the following snippet to your website, such as in your functions.php file: https://pastebin.com/h0pczezU

    This taps into WordPress hooks. I’m considering an easier way to extend the associated cache for custom behaviors like this. If this is introduced I’ll let you know.

    Thread Starter HisKingdomProphecy

    (@hiskingdomprophecy)

    Hi Corey,

    Thanks so much for that php snippet.

    It seems to work 100% and the 3 posts I have done all show fully on the theme’s breadcrumb navigation.

    Looks like this issue is well solved!

    Regards and thanks,
    Angus

    You’re most welcome, Angus. I’m glad to hear that it resolved the issue you were experiencing.

    If you haven’t already and are able, leaving a review is always appreciated.

    Thread Starter HisKingdomProphecy

    (@hiskingdomprophecy)

    Hi Corey,

    I hope you don’t mind me coming here to get some additional information from you. I really don’t want to open a new ticket on this.

    The CE plugin is working fine, but I am having problems with another plugin, and you’re your confirmation of how CE works – at a basic level – I pray will help me understand what is happening and give me some better insight.

    Most of our error message contain no “referrer”. I guess that MAY mean that they are “post” related. If that is the case, these posts are served by the CE cache – which was full at the time of testing – and so I don’t know why they generate a message…

    However, several of the error messages did define a “referrer” and these are either:
    a) the website root,
    e.g. referer: https://www.hiskingdomprophecy.com/
    … and I know the front page is not cached, if that is what this refers to.

    b) a static page – which contains a list of posts
    e.g. referer: https://www.hiskingdomprophecy.com/all-prophecy-articles/

    or
    c) a WP generated author page, etc..
    e.g. referer: https://www.hiskingdomprophecy.com/author/adrianne-kendell/

    referer: https://www.hiskingdomprophecy.com/2021/06/14/’
    

    referer: https://www.hiskingdomprophecy.com/page/2/’

    To my untrained eyes and understanding, my interpretation of the data from our Error Message Log, is that CE only caches the posts and not static pages or author pages.

    The reason I say this, is that a couple of author pages were called 2x in 3 min. and 4x in 6 min.

    Since our testing period was only 12 mins, that was a surprise to me to see these repeated error calls related to the same referer. I can see how this is helping contribute to our high load averages. But that is another issue.

    Previously I thought that CE was caching posts and static pages too.

    So, my question is simple, does CE normally cache static pages and WP-generated author other data pages?

    As I say, this is only to understand how CE currently works, so I/we can perhaps better interpret the error messages from others. Sometimes my understanding on these things misses the mark 🙂

    Regards and thanks,
    Angus

    Happy to help. 🙂 Cache Enabler is a page caching plugin that has the ability to cache any page. In this context when I say page I’m not referring to the post type page in WordPress, but any path to an HTML document. This is posts, pages, categories, tags, etc. For example:

    • https://www.example.com/
    • https://www.example.com/page/2/
    • https://www.example.com/about-us/
    • https://www.example.com/a-great-article/
    • https://www.example.com/author/john-doe/
    • https://www.example.com/category/category-1/
    • https://www.example.com/tag/tag-1/

    In a basic description a static asset would be data that doesn’t change upon being requested again. A dynamic asset would be data that does change upon being requested again. In Cache Enabler’s case, the HTML file saved is static because the same data will always be returned when that file is requested. It’s not dynamically generated by WordPress based on the request. Pulling data from an HTML file is much faster than spinning up various parts of an application to generate the output required (e.g. database queries, template rendering, etc.).

    As for anything HTTP Referer related that shouldn’t be affected by Cache Enabler. This is an HTTP request header sent by the browser (depending on the Referrer-Policy).

    Thread Starter HisKingdomProphecy

    (@hiskingdomprophecy)

    Hi Corey,

    Thanks you so very much for this.

    Since we have no dynamically generated content on our site — all is static html — then this confirms that the same “referrer” ought not to come up on our list more than once at a time, as it should have been cached for the second call.

    I shall now go back to the plugin authors and suggest that they perhaps need to look in a different area for the error.

    Again, thanks so very much for your help and explanation.
    Regards,
    Angus

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Suggest for Cache Refreshing’ is closed to new replies.