Implementing AJAX in IBM WCM Portlet Part 2
Hi Folks,
Last time I posted article on how to implement AJAX in the IBM WCM Portlet. The missing from that writing is the content caching portion. In this article, I will finish up that portion for the completeness of the entire solution.
IBM WCM stores the content inside the JCR database, which stores the entire content as XML record, which makes developer a bit tough to interface with it. The best approach is to use the IBM WCM API. This API is limited in the sense that we can have a flexibility to search content based on a certain content attribute, for example: search based on content title, or published date, etc.. Apart from that, this API provides some generic functions to do content filtering, based on categories, authoring templates, or site areas. However, once again this does not really help. At the end of the day, we will hit some performance problem just to get it done according to the content filtering requirement that is not supported by the basic IBM API.
But, do not worry, as this problem can be solved by implementing the content caching. The following is the concept to do the content caching:
- Use the file system caching. It means that the portlet should check if the a particular content is already cached. If the cache exists, then the portlet should take the content from the cache, otherwise, retrieve from WCM repository via the WCM API
- As the content is always cached, then there is a need to update the cache, in case the actual content gets updated. To achieve this, we need to have a job program that is scheduled to run upon the success of the content syndication. This job program will basically purge the folder where the cache files reside.
- Upon the completion of this job execution, another job program will run to perform an HTTP call the Portal page, and this will automatically re-generate the cache files (see point 1) for this technique.
- If the point 3 cannot be achieved, then we should provide another job program which is run within the Portal environment (this can be a Java cron job, using Quartz and Servlet). This program will call the WCM API and regenerate the cache file.
Of course we can use the database to cache the content, if file system cache is not feasible, especially in the clustered environment.
Hope this will explain.
Cheers!!
leave a comment