Open kushh23 opened 1 year ago
Here I tried to engage with the user and learn more about the use case and I don't think a scheduled cache will add a great benefit a better approach is having a mechanism in the wp plugin that listens when the image is updated on the site and clear the cache for that image.
@Codeinwp/optimole I tried to implement something, and that seems to work here, with the ?ver=
trick not really regenerating the image. I tried it on a couple of hosts to to make sure it's not something related to the host https://www.loom.com/share/ef4e398876924767aaeab7fa05359e04
Let me know if you guys have any input on this.
What problem does this address?
When images are updated, and using the same name, the cache for those images isn't busted, and the website shows the same image.
As an example, this user automatically updates the images using WP All Import, and those images might have the same path: https://secure.helpscout.net/conversation/2307837639/378462
What is your proposed solution?
Implement a mechanism where we listen for image updates and bust cache for individual images.
Initial issue body
### What problem does this address? A user has suggested a feature for the implementation of a scheduled cache-clearing functionality within the Optimole WordPress plugin. The proposed feature aims to automatically clear the cache resources at predefined intervals, such as every few hours, thus ensuring that the latest and accurate images are consistently displayed on the site. https://secure.helpscout.net/conversation/2307837639/378462 ### What is your proposed solution? We should have a solution that listens when the attachment is updated, maybe to some action hook, and when the update is happening, we trigger a cache clear for that particular image. ### Will this feature require documentation? (Optional) Yes, it requires documentation.