how to clear binaries cache

26 views
Skip to first unread message

Brian Street

unread,
Apr 25, 2018, 7:33:25 PM4/25/18
to Hippo Community
We created a "responsive image" component that uses the <picture> element with child <source srcset="..." media="..."> elements.
I also configured Custom Resource Containers to name the image variants instead of having funny ending paths. 
For example:
<picture class="img-flexible">
    <source srcset="/binaries/tiny/content/gallery/.../hero-image.jpeg" media="(max-width: 480px)">
    <source srcset="/binaries/medium/content/gallery/.../hero-image.jpeg" media="(max-width: 768px)">
    <source srcset="/binaries/banner/content/gallery/.../hero-image.jpeg" media="(max-width: 1200px)">
    <img class="img-flexible" src="/binaries/content/gallery/.../hero-image.jpeg" title="My Banner Image" alt="pretty banner">
</picture>

The problem is one of the image variants is cached as an old version of the image.  How do I clear/rebuild the BinaryServlet cache with named image variants?  If I use my browser to get the "banner" variant, it has an old version compared to what is uploaded in the CMS gallery.  Rebooting the hippo servers did NOT clear the cache of the old image variant.

Thanks,
Brian

Woonsan Ko

unread,
Apr 26, 2018, 12:58:31 AM4/26/18
to hippo-c...@googlegroups.com
On Wed, Apr 25, 2018 at 7:33 PM, Brian Street <brian.c...@gmail.com> wrote:
We created a "responsive image" component that uses the <picture> element with child <source srcset="..." media="..."> elements.
I also configured Custom Resource Containers to name the image variants instead of having funny ending paths. 
For example:
<picture class="img-flexible">
    <source srcset="/binaries/tiny/content/gallery/.../hero-image.jpeg" media="(max-width: 480px)">
    <source srcset="/binaries/medium/content/gallery/.../hero-image.jpeg" media="(max-width: 768px)">
    <source srcset="/binaries/banner/content/gallery/.../hero-image.jpeg" media="(max-width: 1200px)">
    <img class="img-flexible" src="/binaries/content/gallery/.../hero-image.jpeg" title="My Banner Image" alt="pretty banner">
</picture>

The problem is one of the image variants is cached as an old version of the image.  How do I clear/rebuild the BinaryServlet cache with named image variants? 
BinariesServlet checks if the cached binary item is still valid by investigating the variant node's jcr:lastModified against the cache item's lastModified date, in every N seconds (180s or validity-check-interval-seconds init param). If it turns out invalid, it removes the cached item and retrieve the binary data again. ref: BinariesServlet#getPageFromCacheOrLoadPage() and #getValidatedPageFromCache(). So, I don't think the cache items in the server side is the problem if you refreshed the browser after N seconds (180 by default).
But BinariesServlet sets response headers as well for client-side caching. So make sure you clear the browser cache when testing.

Regards,

Woonsan
 
If I use my browser to get the "banner" variant, it has an old version compared to what is uploaded in the CMS gallery.  Rebooting the hippo servers did NOT clear the cache of the old image variant.

Thanks,
Brian

--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-community@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-community+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages