I'm wondering it's possible to call (trigger) method on the frontend when admin changes something in backend (admin panel)

Suppose that I have banner which has image with 24h cache-validation time. I want to refresh local storage after admin's save action in the banner section and I know that I don't have possibility to get customer's local storage via PHP. I have been done plugin which executed function afterSave only so far but what's next? do you have any ideas


Why don't you use a dynamic name for the banner image?

That way the browser honors cache setting as long as that image hasn't changed... but when the admin user saves an update, the source of the image rendered in the HTML is new and therefore has no cache.

Something like:


The MD5 hash (or a smaller substring) is generated based on the model updated_at, or any other algorithm you want to determine that its a unique image.

  • Hey Phil! Thanks for your reply. I appreciate it. I think that change banner_image_name is not good way to solve my problem because client has key in localStorage aka mage-banners-cache-timeout and reloading banner image is depends on that value for that reason change name of banner image doesn't help me. Maybe I don't understand your way? Thanks in advance.
    – corey
    Dec 3 '16 at 8:14
  • I assumed that you meant HTTP Header Cache Control (max age): developers.google.com/web/fundamentals/performance/…. With this system, once the browser has cached the image, it will no longer check for an updated version of the resource with that same name until the max-age period expires. Changing the name of the resource IN THIS CASE will reset the cache with the new image.
    – Phil M
    Dec 5 '16 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.