A results caching plug-in can generate a page for a request in three parts:
A header, such as a page banner, which changes for every request
A body, which changes less frequently
A footer, which also changes for every request
Without this feature, a plug-in would have to generate the whole page for every request unless an IFRAME is used, where the header or footer is sent in the first response along with an IFRAME pointing to the body. In this case, the browser must send another request for the IFRAME.
If the body of a page has not changed, the plug-in needs to generate only the header and footer and to call the dr_net_write function instead of net_writewith the following arguments:
Header
Footer
Handle to cache
Key to identify the cached object
The Web Server constructs the whole page by fetching the body from the cache. If the cache has expired, the Web Server calls the refresh function and sends the refreshed page back to the client.
An Init SAF that is visible to the plug-in creates the handle to the cache. The Init SAF must pass the following parameters to the dr_cache_init function:
RefreshFunctionPointer
FreeFunctionPointer
KeyComparatorFunctionPtr
RefreshInterval
The RefreshInterval value must be a PRIntervalTime type. For more information, see the NSPR reference at http://www.mozilla.org/projects/nspr/reference/html/index.html.
As an alternative, if the body is a file that is present in a directory within the web server system machine, the plug-in can generate the header and footer and call the fc_net_write function along with the file name.
This chapter lists the most important functions that a results caching plug-in can use. For more information, see the install-dir/include/drnsapi.h file.