Tips for Managing Caching During Development
Several caching mechanisms operate when you display Zen Mojo pages, and these can prevent you from seeing the most recently compiled version of a page. This appendix provides information on disabling these mechanisms and on clearing the caches, so that you can avoid frustration during the development process. This appendix discusses the following topics:
CSP Gateway Cache
Zen Mojo uses the CSP Gateway, which can cache files automatically, depending on how your web application is defined (see “Parts of a Zen Mojo Application,” in the first chapter).
To prevent the CSP Gateway from caching files for your Zen Mojo application:
-
In the Management Portal, click System Administration > Security > Applications > Web Applications. This displays the System, Security Management, Web Applications page.
-
Click the name of the web application that contains your Zen Mojo page.
-
For the Serve Files option, select Always.
-
Click Save.
To clear this cache, if needed, do the following:
-
In the Management Portal, click System Administration > Configuration > CSP Gateway Management.
-
Click System Status.
When you are prompted to log in, provide a username and password.
-
In the bottom part of the page, click the Clear Cache button for each page that you want to remove from this cache.
When you deploy the application, it is generally best to change the Serve Files option to Always and cached.
Browser Cache
For information on disabling caching by the browser and on clearing the browser cache, see the help provided by your browser.
The browser cache is separate from the CSP Gateway cache and is used at a later stage when serving a page. This means that when you clear the caches, you should clear the browser cache after clearing the CSP Gateway cache.
Note that your browser might provide different options for refreshing the display (using the cache) and for reloading the page (bypassing the cache). For example, on Chrome, the F5 button refreshes the display and Ctrl+R reloads the page.
Zen Mojo Page Cache
Zen Mojo also caches information, as described earlier in this book. There is no switch to disable this mechanism as a whole, but you can invalidate this cache at suitable points in your processing. To do so, invoke the invalidate() method of the documentView instance or of the Zen Mojo page.