Wednesday, May 16, 2012

DataPower: Flushing Stylesheet Cache.

Summary: Why aren’t my changes to the stylesheets being picked up by DataPower? Learn about the stylesheet cache in DataPower and what you should do to refresh the cache.

DataPower appliances maintain a cache of the stylesheets that are being used on the appliance for performance reasons. "Although the cache is configurable, disabling the cache might degrade performance. DataPower caches compiled stylesheets and if the cache is disabled the stylesheets will have to be compiled every time they are used." - [1]

Ever get into a situation where you have made a change on an imported/included stylesheet on DataPower and when the stylesheet was run, you did not see the changes you made being reflected in the results?

The reason is that DataPower fetches all the content from top level stylesheet with any imported and included stylesheets and after compilation stores it in the cache as one single compiled stylesheet. If you make changes to one of the imported/included stylesheets, DataPower does not detect the change and the recompilation and refreshing the same in the cache is not triggered.

In such scenarios, for the changes to be reflected, you could do two things

  1. You could flush the stylesheet cache. One way of doing this would be to use the WebGUI administrative interface. In the GUI select objects/XML Processing/XML Manager. Select the respective xml manager and to the top right corner you should see option called “Flush  Stylesheet Cache”.
  2. DataPower: Flush Stylesheet Cache
  3. You could introduce an empty line in the top level xslt and save it. This will trigger recompilation of that top level stylesheet effectively recompiling the imported/included stylesheets also.
 “At compile time all imported and included stylesheets are fetched and the complete compiled top level stylesheet is then cached. You can't see the imports and includes but they are all there under the top stylesheet.” – [2]

“Disabling the cache can be performance concern and might not be your goal. When style sheets are not cached, an XSLT compilation is run on every single transaction.

If you need to disable stylesheet caching, create a separate XML Manager for the particular service wherestylesheet caching is not required.

Do not disable stylesheet caching for a widely used XML Manager. For example, do not disable caching on the default XML Manager.” – [1]