Not only can you cache these files on the dispatcher server but you can also make use of the visitor’s browser cache. If you allow files to be cached directly in the browser, the amount of load placed on the dispatcher server decreases drastically. You can inform the browser that it is actually is okay for it to cache JavaScript and CSS files for a few days or maybe even weeks depending on your release cycle. But what happens when you make a change in these files before they have expired in the visitor’s browser cache? Well, then you have a problem, the user does not receive any changes unless they actually clear their browser cache, which is something that one cannot demand of their visitors.
This article explains a workaround for this issue when using AEM. The basic idea is by using Sling selectors; you can append a version number to the CSS/JavaScript files so that they will change with each release. This affects the actual name of the file so it does not matter if the browser has cached the scripts because it will look for the new file in the browser cache. Because this file does not already exist, it will fetch this new file from the server and the user will receive the latest changes.
You can create a custom Adobe Experience Manager (AEM) Link Rewriter that is based on the Apache Sling Rewriter module. This module is used for rewriting the output generated by the Sling rendering process.
Note: For more information about a Sling Rewriter, see Apache Sling Rewriter.
An Adobe CQ Link Rewriter is implemented as an OSGi bundle that contains a Java class that extends the org.apache.sling.rewriter.Transformer class. For information, see Interface Transformer.
To read this development article, click http://helpx.adobe.com/experience-manager/using/creating-link-rewrite.html.
No comments:
Post a Comment
If you have any doubts or questions, please let us know.