EFP: Navigation Caching
A significant part of implementing an External Facing Portal is simply to improve performance so the site isn’t a headache to use for public users — such as, potential customers and partners. One way the portal now tries to improve performance is to cache a user’s navigation hierarchy and nodes. The next time the user — or another user with the exact same navigation hierarchy — launches the framework page, the portal can take the navigation hierarchy from the cache instead of creating it from scratch. Navigation caching works in the background, and there’s not much you have to do — except turn it on!! For background information on navigation and navigation hierarchies, see Navigating in the Portal in the Portal Developer Guide on the Help Portal.
- Whether navigation caching is turned on (portal.navigation.cache.enable)
- The maximum size of the navigation cache (portal.navigation.cache.lifetime)
- For how long each object is valid (portal.navigation.cache.maxsize)
These settings are read-only, and can be changed using the SAP J2EE Visual Administration tool. By default, navigation caching is turned off. Generally, there is a testing period, during which navigation hierarchies are changing, so it makes sense not to cache navigation nodes at this stage. After roles have been created and assigned and the portal is in production, you can turn on navigation caching.
Objects in the Cache
You can see a list of the navigation nodes currently in the cache, with the long name shown as a link. Click on the link to display the page that corresponds to the navigation node. For each node, you can click on the plus sign (+) and see information about the node, such as:
- Short URL
- Children nodes
- Merge ID
Clearing the Cache
If you make changes to an existing role — for example, by adding a page to a workset — you need to clear the cache for the change to take effect. If you don’t clear the cache, the navigation service will take the workset as it exists in the cache — without the changes. You do not have clear the cache if you are simply adding a user to a role, or creating a new role. To clear the cache, simply click Clear Cache. You cannot clear a single node.
Changes to Navigation Connector API
In order to add methods to the navigation connector API but keep the portal backward compatible with existing connectors, the existing INavigationConnector interface was unchanged. A new interface was created based on INavigationConnector, called INavigationConnectorExt. The interface defines two new methods, getNodeByQuickLink(), which is mentioned in another EFP: Quick Links about Quick Links, and getConnectorCacheDiscriminator() for enabling navigation caching for the connector. It is now recommended to create navigation connectors by extending the new class AbstractNavigationConnector instead of implementing the INavigationConnector or INavigationConnectorExt interfaces.
The getConnectorCacheDiscriminator() method returns a key — a String — for the set of nodes for the current user. The following is the signature:
public String getConnectorCacheDiscriminator(Hashtable environment);
You may want to create the navigation nodes — and, therefore, the cache discriminator — based on the current user. You can retrieve the IUser object for the current user from the Hashtable passed into the method, as follows:
IUser user = (IUser)
The final discriminator that the Navigation service saves for a user’s entire collection of navigation nodes from all navigation connectors is a combination of the discriminators generated by all navigation connectors for the user’s set of navigation nodes.
The following are the weblogs in the series on External Facing Portal:
- Nuts and Bolts of the External Facing Portal (EFP)
- EFP: Navigation and Framework Tag Libraries
- EFP: Layout Tag Library
- EFP: Navigation Caching
- EFP: Quick Links
- EFP: Short URLs