Net.Data Books

Administration and Programming Guide for OS/390

Enabling Dynamic Web page Caching

Use the following steps to configure Net.Data for caching:

Step 1: Specify the Web Pages to be Cached: DTW_CACHE_PAGE

Use one or more DTW_CACHE_PAGE directives to identify the Web pages that are to be cached. Specify the directives in the Net.Data configuration file.

Syntax:

DTW_CACHE_PAGE file_name_spec|path_template_spec lifetime usage_scope 

Where:

file_name_spec
Is the specification of one or all of the HTML blocks within a macro. To specify one HTML block, use the fully qualified name of the macro and the block name. To specify all HTML blocks, use the fully qualified macro name and the suffix /*. Net.Data caches all Web pages that it creates by executing this HTML block. Specify this value or path_template_spec, but not both.

path_template_spec
Is the specification of HTML blocks within macros, using a path template for one or more directories containing macros. A path template must contain the suffix /*. Net.Data caches all Web pages that it creates by executing an HTML block of any macro contained within any of these directories. Specify this value or file_name_spec, but not both.

lifetime
Specifies the number of seconds that a cached Web page is valid

usage_scope
Specifies the degree to which the reuse of the Web page is restricted. Reuse is granted or denied based on the user ID associated with the Net.Data request. Usage_scope can have one of the following values:

PUBLIC
The cached page can be reused for any request associated with a user ID that is authorized to execute the macro.

PRIVATE
The cached page can be reused for any request associated with the user ID that was associated with the request that originally cached the Web page.

You can specify this directive multiple times. Specify one DTW_CACHE_PAGE directive for each file_name_spec or path_template_spec value. If DTW_CACHE_PAGE directives conflict with each other, the first directive specified takes precedence.

A cached page is reused for a request if the URL, the form data, and the query string of the request match the URL, form data, and query string of the request that originally cached the page.

Examples:

Example 1: Specifies the caching of any Web pages generated when Net.Data executes the specified HTML block

DTW_CACHE_PAGE /u/USER1/macros/main.d2w/output  3600 PUBLIC

In this example, Net.Data caches the Web pages generated when it executes the output HTML block in the macro main.d2w, located in the /u/USER1/macros directory. The Web pages have PUBLIC scope, and remain valid for 1 hour.

Example 2: Specifies the caching of any Web pages generated when Net.Data executes any HTML block in the specified macro

DTW_CACHE_PAGE  /u/USER1/macros/main.d2w/*  3600 PUBLIC

In this example, Net.Data caches any Web pages Net.Data generates when it executes any HTML block in the macro main.d2w, located in the /u/USER1/macros directory. The Web pages have PUBLIC scope, and remain valid for 1 hour.

Example 3: Specifies the caching of any Web pages generated when Net.Data executes HTML blocks in macros located in one or more directories

DTW_CACHE_PAGE  /u/USER1/macros/*  3600 PUBLIC

In this example, Net.Data caches any Web pages Net.Data generates when it executes any HTML block in any macro located in the /u/USER1/macros directory or its subdirectories. The Web pages have PUBLIC scope, and remain valid for 1 hour.

Example 4: Specifies the caching of any Web page generated by all Net.Data macros

DTW_CACHE_PAGE  /*  3600  PUBLIC

In this example, Net.Data caches all Web pages Net.Data generates. The Web pages have PUBLIC scope, and remain valid for 1 hour.

Example 5: Specifies multiple Web page caching directives

    DTW_CACHE_PAGE  /u/USER1/macros/main/*  1800  PUBLIC
    DTW_CACHE_PAGE  /u/USER1/macros/special/daily_news.d2w/*  43200  PUBLIC
    DTW_CACHE_PAGE  /u/USER1/macros/special/employee_stats.d2w/*  3600  PRIVATE
In this example, Net.Data caches all Web pages generated from any HTML block in any macros located in the /u/USER1/macros/main/ directory. The Web pages have PUBLIC scope and remain valid for 30 minutes. All Web pages generated by the daily_news.d2w macro in the directory /u/USER1/macros/special/ have PUBLIC scope and remain valid for 12 hours. All Web pages generated by the employee_stats.d2w macro in the directory /u/USER1/macros/special/ have PRIVATE scope and remain valid for 1 hour.

Step 2: Set Up the Web Page Cache

Set up the table used to cache Web pages.

  1. Create the Web page cache table, SYSIBM.DTWCACHEDPAGES, using the SQL found in DTW220.SDTWSPUF(DTWCRCCH). This file also includes SQL statements to create a database, called DTWCACHE, and a tablespace, called DTWTBSP1, for the Web page cache.

    In a data sharing environment, the CREATE TABLESPACE statement that creates the tablespace for SYSIBM.DTWCACHEDPAGES and SYSIBM.DTWCACHEDEPS should specify GBPCACHE CHANGED.

  2. Define the stored procedure used to insert the cached pages into SYSIBM.DTWCACHEDPAGES. The stored procedure is found in DTW220.SDTWLOAD(DTWCCHIN).
    1. Copy the stored procedure into your stored procedure library.
    2. Define the stored procedure.
      • The SQL to define the stored procedure when using DB2 for OS/390 V5 is found in DTW220.SDTWSPUF(DTWCCHV5).
      • The SQL to define the stored procedure when using DB2 UDB Server for OS/390 V6 is found in DTW220.SDTWSPUF(DTWCCHV6).
  3. Bind the stored procedure's DBRM DTW220.SDTWDBRM (DTWV22IN) into the package DTWCACHEPKG using a user ID with INSERT, SELECT, and DELETE privileges on SYSIBM.DTWCACHEDPAGES. The user IDs associated with the requests that cache pages must have EXECUTE privilege on the package DTWCACHEPKG.

    The JCL for this step is located in DTW220.SDTWBASE(DTWCCHBD).

After you have set up this table and stored procedure, you can begin caching Web pages.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]