Documentation Archive Developer
Search
PATH  Documentation > WebObjects 4.5 > WebObjects Developer's Guide


Table of Contents Previous Section

Cache Component Definitions

As described in the chapter "WebObjects Viewed Through Its Classes", each component has a component definition consisting of the component's template (the result of parsing the .html and .wod files) and information about resources the component uses. If you cache component definitions, the .html and .wod files are parsed only once per application rather than every time they are changed. When caching is disabled, at each new instance of a component the time stamp of the .html and .wod are checked to see if the files have been modified. If they have, they're reloaded.

To cache component definitions, use WOApplication's setCachingEnabled: method:

public Application() {
super();
this.setCachingEnabled(true);
...
}
By default, this type of caching is disabled as a convenience for debugging. If component-definition caching is disabled and you're writing an entirely scripted application, you can change code in a scripted component and see the effects of that change without having to relaunch the application. You should always enable component-definition caching when you deploy an application, since performance improves significantly.

Instead of using setCachingEnabled:, you can also perform
component-definition caching by setting the WOCachingEnabled user default either on the command line or using the defaults command.

HelloWorld -WOCachingEnabled YES
defaults write HelloWorld WOCachingEnabled YES
For more information on command-line options, see the online document Serving WebObjects.

Table of Contents Next Section