Table of Contents Previous Section
When users navigate to a page of an WebObjects application for the first time, a WOComponent object associated with the page is created and (in init) initialized. When users go to another page, the original component typically does not go away. It persists through an arbitrary number of subsequent transactions before it's deallocated. Thus when users backtrack to a page they visited earlier (as long as the transaction limit hasn't expired) things are as they left them---displayed results, entered values, and selected options.
You set the number of pages the application caches, and thus the life span of an application's components, with WOApplication's setPageCacheSize: method. If the page-cache size attribute is not explicitly set, the default is 30 pages. You can also determine the current transaction limit by sending pageCacheSize to the application object.
To minimize the size of a session, you can reduce the page-cache size or you can turn off page caching altogether by setting the page-cache size to zero. If you turn off page caching, you must to re-initialize each page for each transaction it's involved in. You can perform initializations in init or awake, since both are invoked with identical frequency.
Relying on the page cache to retain the state of a page for a user introduces certain issues and problems. One implication, of course, is scalability. If you want finer control over this aspect of an application, consider selectively storing page state in session variables, reinitializing variables in the awake method, or some combination of the two.