• onlylowercaselettersandnumbers

    (@onlylowercaselettersandnumbers)


    Hi

    We have a site that uses WP Rocket and would like to clear the cache for products affected when a discount is created. Otherwise the discount won’t be visible.

    Is that even possible with this plugin?

    Also, there is a start / end time for discounts, so not even sure how it should be triggered.

    I could create a cron job that checks for discounts and clears the cache for the term when needed, but it seems like a lot of work for what I assume is a common problem.

    Any suggestions are welcome ??

    Note: We have 60K+ products, so we want to avoid clearing cache on the whole site. A discount can be anywhere between 5 and 14000 products.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Marco Almeida | Webdados

    (@webdados)

    Hi there @onlylowercaselettersandnumbers and sorry for the delay.

    This is a good point that you’re raising here, and we already thought about this more than once, but there are a few issues that must be taken into account:

    • WP Rocket is just one of the cache plugins out there and it will not be easy to support them all.
    • Clearing the cache selectively is also not that easy. We would have to loop through all the products belonging to the discounted taxonomy and clear its page cache. We should also clear cache for the taxonomy archive pages and any other page where each product could possibly be shown, like related products, featured products, additional taxonomies to which the product belongs to, etc. It’s just not feasible.
    • The start/end time is not tied to any cronjob, so it would be also very hard to clear the cache based on this.

    What we can do is create an action whenever a discount is created, edited or deleted on the admin interface so developers could hook into that action and clear the cache as they pleased.

    We could maybe go further if you are willing to sponsor the development of something specific for your case.

    Thread Starter onlylowercaselettersandnumbers

    (@onlylowercaselettersandnumbers)

    @webdados Yeah, I kind of came to the same conclusion.

    An action would make is possible for us to clear the taxonomy / term / post / whatever with a bit of manual code ?? We just have to avoid the whole time driven thing, but I’m sure we will manage.

    Can you let me know when there’s a version with this feature implemented?

    And to quote Martin Fowler:
    There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

    Plugin Author Marco Almeida | Webdados

    (@webdados)

    Love the quote ??

    Check out version 1.4

    I expect to hear back from you with what you achieved, so we can share it with other users.

    Plugin Author Marco Almeida | Webdados

    (@webdados)

    Any developments on this?

    Thread Starter onlylowercaselettersandnumbers

    (@onlylowercaselettersandnumbers)

    Not yet, the maintainer of the site is currently on holiday, so it will take at least another week before we get the plugin updated.
    I will get back to you as soon as we have something ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Clear cache when discount is created’ is closed to new replies.