How to use the "long cache" feature in HTML Library Manager?

paulr19803740

18-09-2020

There is a "long cache" feature in the com.adobe.granite.ui.clientlibs.impl.HtmlLibraryManagerImpl which apparently has similar functionality to ACS Commons Versioned Clientlibs. However, I can't find any documentation on how it's supposed to work.

 

I've tried this out locally and when I set the "htmllibmanager.longcache.patterns" to "/.*;auto" it generates the clientlib include with a version string like so: /etc.clientlibs/company-name/clientlibs/clientlib-all.lc-1600281673684-lc.css

(note that I also needed to manually click "Invalidate Caches" in http://localhost:4503/libs/granite/ui/content/dumplibs.rebuild.html before this took effect).

 

However, since the cache key is set to "auto", it is automatically generated when this service restarts. In my mind that defeats the purpose since I don't want to restart the service every time I make an update to the CSS or JS in the clientlib. What am I missing? How is this feature supposed to be used so that it really mimics what ACS Commons Versioned Clientlibs is doing?

 

I saw a few people with the same question but no satisfactory answer yet:

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/adobe-granite-html-library...

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/adobe-granite-html-library...

 

cache ClientLibs

Accepted Solutions (0)

Answers (1)

Answers (1)

Singaiah_Chintalapudi

MVP

18-09-2020

This looks like its related to client-side/browser caching. If you're looking for browser side caching, I would strongly recommend to use either Apache or CDN (this is recommended for easier maintenance) to pass the expiration headers for your client libraries.

 

If you can manage these configurations at Apache/CDN then you have more control over the expiration headers for other files i.e. images, documents as well.

 

Let me know whats your requirement?

 

Thanks,

Singaiah