• Resolved gbruzzo

    (@gbruzzo)


    Hello there

    hope you are all well.

    We have recently started using SG Optimizer on our Siteground VPS-based site, switching away from WP Fastest Cache.

    We have a few technical questions (with some premises and a few final suggestions) – we would really appreciate if Hristo Pandjarov or other developers could chime in and provide answers/explanations – we are happy to submit a support ticket if you think it is more appropriate.

    Premises (correct us if we are mistaken):

    – We understand SG Optimizer does not preload cache (as in running through a sitemap or index to actually cache the pages)

    – We understand that pages are cached only temporarily by Nginx (we understand this is the parameter ‘inactive’, usually set at a default of 10 minutes: stale items (items that have not been accessed after this time or whatever time you have chosen) will be deleted.

    – We understand that cache control headers are ignored, and that cache is deleted only if stale as defined by the inactive parameter. (this may be incorrect)

    Questions:

    1) How long do you keep items in cache for (e.g. what is the value of ‘inactive’ you set)?

    2) Do you automatically refresh cache that has gone stale?

    We had a look at https://forum.nginx.org/read.php?2,274264,274264#msg-274264
    and
    https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_background_update

    => it seems it is possible for an nginx server to ‘automatically’ refresh stale cache by serving the first request after an item has gone stale with the stale item while refreshing it in the background.
    This would be incredibly important and welcome! It would mean that, once created, cache could ‘self-perpetuate’ (barring deletions due to content / plugin changes / hook triggers etc).

    This kind of setup would also be incredibly useful to recreate cache after a partial deletion (content update etc).

    3) Refreshing all cache after full cache purge (initiated via purge button in WP admin): Do you do anything to recreate cache in this situation?

    It would be useful to have some minimal crawling mechanism in place. We understand that this could strain a server, but it would be very useful if the user could submit a list of pages whose cache should be crawled immediately after a cache purge. (5 or 10 or more, depending on the strength of the server?) – a bit like workers deployed by cloudflare.

    We would really appreciate if you could help us better understand the caching logic you apply, so as to better deploy our assets across the site etc.

    Thank you very much in advance

    Giacomo Bruzzo

    • This topic was modified 3 years, 8 months ago by gbruzzo.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Hristo Pandjarov

    (@hristo-sg)

    SiteGround Representative

    Hey,

    We keep the cached item in the Dynamic cache for 24 hours by default. That cache is automatically invalidated if content is updated.

    We don’t have stale caching working because it is not suitable for our system and will be far from optimal. Longer cachcing periods work fine. Content that’s not accessed won’t be kept in the cache because that would bloat the cache itself with pages that aren’t accessed regularly / at all. This said, Google usually does that work for you and refreshes the cache crawling your site so rarely a human will get a slower fist hit for content that had expired from the cache.

    Cache is not being preloaded and not being regenerated after purge. That would cause excessive and useless load for the account. Visitors do that for you anyway. Cache preloading makes sense when you use file-based basic plugins but when you have a reverse proxy controlled by headers it just doesn’t make sense.

    Furthermore, we clear the cache in a smart way, depending on the event that has occurred, we don’t just bust all caches no matter what.

    Thread Starter gbruzzo

    (@gbruzzo)

    Dear @hristo-sg

    Thank you very much for taking the time to address my questions above, this enables me to better understand.

    Are there any specific hooks which, when triggered, cause partial or total recrawling?

    Example : if you have a product counter on the single product page and the customer buys that product, you might want to allow for that cache to refresh reflecting the new stock availability etc.

    Thanks for any further info.

    Giacomo Bruzzo

    Plugin Author Stanimir Stoyanov

    (@sstoqnov)

    SiteGround Representative

    Hey @gbruzzo

    We’ve developed a set of rules to purge the dynamic cache in a smart, efficient way depending on the change that has occurred on your site. We do a full purge on events like category deletion, plugin and theme update or switch, WordPress core update, etc. On the other hand, we do smart purge when a post is modified, a comment is added or a category is updated for example.

    You can check the hooks that we use here:
    https://plugins.trac.www.ads-software.com/browser/sg-cachepress/trunk/core/Supercacher

    Regards,
    Stanimir

    Thread Starter gbruzzo

    (@gbruzzo)

    Dear @sstoqnov

    Thank you for your response and for sharing the link: will look at the code in detail and revert, if I have more questions.

    Giacomo Bruzzo

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Some technical questions’ is closed to new replies.