Hi,
We have a requirement where we need to render the last updated image asset on the page. The issue is that CDN cache is configured and it will not serve the most recently updated asset as it will be invalidated only after 180 days.
In order to render the most recent asset, we need to do something programmatically to always render the most recently updated image. One suggestion was to append the last updated date to the image name at runtime to invalidate the cache. But need some details around this as to how this works and how to implement this programmatically.
Has anybody done this kind of an implementation? Appreciate your help on this.
Thanks
@Vish_dhaliwal @vanegi @Vikram_Gaur_
Solved! Go to Solution.
Views
Replies
Total Likes
Two scenarios can apply
1) In one of our use case, we implemented a workflow that will trigger when an asset is modified to Invalidate CDN cache
public void execute(final WorkItem workItem, final WorkflowSession workflowSession, final MetaDataMap arg)
throws WorkflowException {
try {
Asset asset = getAssetFromPayload(workItem, workflowSession.adaptTo(Session.class));
ResourceResolver resourceResolver = resourceResolverFactory.getServiceResourceResolver(
Collections.singletonMap("sling.service.subservice", (Object)EAEM_CACHE_INVALIDATION_PROCESS));
CdnCacheInvalidationParam cacheInvalidationParam = getCdnCacheInvalidationParam(config, asset);
=========
2) Did you check the AdaptiveImageServlet --> requestLastModifiedSuffix = getRequestLastModifiedSuffix(suffix);
Two scenarios can apply
1) In one of our use case, we implemented a workflow that will trigger when an asset is modified to Invalidate CDN cache
public void execute(final WorkItem workItem, final WorkflowSession workflowSession, final MetaDataMap arg)
throws WorkflowException {
try {
Asset asset = getAssetFromPayload(workItem, workflowSession.adaptTo(Session.class));
ResourceResolver resourceResolver = resourceResolverFactory.getServiceResourceResolver(
Collections.singletonMap("sling.service.subservice", (Object)EAEM_CACHE_INVALIDATION_PROCESS));
CdnCacheInvalidationParam cacheInvalidationParam = getCdnCacheInvalidationParam(config, asset);
=========
2) Did you check the AdaptiveImageServlet --> requestLastModifiedSuffix = getRequestLastModifiedSuffix(suffix);
@aem-enthusiast we can have CDN cache clearing in many ways?
1. Via workflow: can be manually triggered or can be clubbed with publish workflow if you already have one.
2. Replication Preprocesser
3. Replication event listener
3. Replication custom flush agent
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies