Skip Headers
Oracle® Application Server Web Cache Administrator's Guide
10g Release 2 (10.1.2)
B14046-04
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

13 Sending Invalidation Requests

This chapter explains how to send invalidation requests to OracleAS Web Cache.

This chapter contains these topics:

Invalidation from External Sources

This section provides the following topics for understanding how to send invalidation requests from external sources:

Role of the invalidator and administrator Accounts

To invalidate objects in the cache, send an HTTP POST request from the invalidator, ias_admin, or administrator account through an invalidation listening port.

The invalidator account is an administrator authorized to send invalidation requests. In a cache hierarchy of OracleAS Web Cache servers, the central cache or provider cache uses the invalidator account name and password of the remote or subscriber OracleAS Web Cache server. The invalidation request specifies the objects to invalidate, as well as the site host name of the objects. The site host name is compared with the IP address of the cache from which the invalidation request was propagated. If there is a match, the cache processes the invalidation request. Otherwise, the request is rejected.

While the ias_admin or administrator account typically sends configuration and administration requests to OracleAS Web Cache, you can also use it to send invalidation requests. Because the ias_admin or administrator account is authorized with more privileges than the invalidator account, an invalidation request sent by an ias_admin or administrator account does not need to specify the site host name. Invalidation requests sent from Application Server Control Console use the administrator account; invalidation requests send from OracleAS Web Cache Manager use the administrator account.

For automatic propagation of invalidation messages, OracleAS Web Cache passes the encoded invalidator password in the page request between the central and remote cache or the provider and subscriber cache during the hierarchy registration process. This HTTP traffic is susceptible to network sniffing. If the network is unprotected and insecure, configure HTTPS ports as follows:

  • From the Ports page of Application Server Control Console (Web Cache Home page > Administration tab > Properties > Web Cache > Ports) or the Listen Ports page of OracleAS Web Cache Manager (Ports > Listen Ports) of the central or provider cache, disable the default HTTP port and configure an HTTPS port in its place. See "Task 6: Configure OracleAS Web Cache with Listening Ports for Client Requests".

  • From the Ports page of Application Server Control Console (Web Cache Home page > Administration tab > Properties > Web Cache > Ports) or the Operations Ports page of OracleAS Web Cache Manager (Ports > Operations Ports) of the remote or subscriber cache, disable the default HTTP port for invalidation and configure an HTTPS port in its place. See "Task 8: Configure OracleAS Web Cache with Operations Ports".


See Also:


Format of Invalidation Requests

The HTTP POST requests are written in Extensible Markup Language (XML) syntax. The contents of the XML request body instructs the cache which URLs to mark as invalid.

Propagation of Invalidation Messages

Propagation of invalidation messages from one OracleAS Web Cache server to another occurs in the following deployments:

  • Cache hierarchy whereby one OracleAS Web Cache server acts as an origin server to another OracleAS Web Cache server

  • Cache cluster with multiple OracleAS Web Cache servers

Invalidation in Hierarchies

In a configuration with a hierarchy of OracleAS Web Cache servers, it is likely that content will be cached on multiple servers.

Figure 13-1 depicts a distributed cache hierarchy. A central cache is located in the United States office, and a remote cache is located in the Japan office. While the central cache stores content from an application Web server, the remote cache stores content from the central cache. In other words, the central cache acts as an origin server to the remote cache in Japan.

When an invalidation message is sent to the central cache to refresh content, the central cache automatically propagates the invalidation message to the remote cache in Japan to ensure consistency.

Figure 13-1 Scenario 1: Invalidating Content in a Distributed Cache Hierarchy

Description of Figure 13-1  follows
Description of "Figure 13-1 Scenario 1: Invalidating Content in a Distributed Cache Hierarchy"

Figure 13-2 depicts an ESI cache hierarchy. A subscriber cache performs Edge Side Includes (ESI) assembly. Provider caches locally cache ESI fragments for ESI provider sites www.providersite1.com and www.providersite2.com. During ESI page assembly, the subscriber cache contacts the provider caches for the ESI fragments.

Figure 13-2 Scenario 2: Invalidating Content in an ESI Cache Hierarchy

Description of Figure 13-2  follows
Description of "Figure 13-2 Scenario 2: Invalidating Content in an ESI Cache Hierarchy"

When an invalidation message is sent to a central or provider cache to refresh content, the central or provider cache automatically propagates the invalidation message to the remote or subscriber cache to ensure consistency.

To ensure that the central or provider cache only invalidates its content, the remote or subscriber cache checks the site host name specified in the invalidation message with the IP address of the provider cache from which the invalidation message was propagated. If there is a match, the remote or subscriber cache processes the invalidation request. Otherwise, the request is rejected. For distributed cache hierarchies, the site host name for the central and remote caches should be configured to be identical, making a mismatch unlikely.


See Also:


Invalidation in Cache Clusters

In a cache cluster, administrators can decide whether to propagate invalidation messages to all cache cluster members or to send invalidation messages individually to cache cluster members.

When OracleAS Web Cache propagates invalidation messages, the cache that received the invalidation request acts as the invalidation coordinator for that request. The coordinator propagates the invalidation messages to the other cluster members. The coordinator waits for responses from all cluster members. When the propagation completes, the coordinator returns a message to the sender that lists, for each cluster member, the cluster member name, the status of the invalidation request, and the number of objects invalidated.

If any cluster member cannot be reached, OracleAS Web Cache returns an error message and does not propagate the invalidation messages.

During a cache cluster upgrade, you upgrade one cache cluster member at a time. The caches will continue to respond to requests. However, because other cluster members have a different version of the configuration, the caches will not forward invalidation messages to those cache cluster members operating with a different version. Instead, if the requested object is not cached by that cache or by cluster members with the same version of the configuration, OracleAS Web Cache forwards the request to the origin server.

When the cache cluster members are not running the same version of OracleAS Web Cache, you can still invalidate objects, and you can propagate the invalidation to other cluster members, but the invalidation message must originate from the cache that is operating with the earlier version of OracleAS Web Cache.


See Also:

  • Oracle Application Server Upgrade and Compatibility Guide for more information about upgrading OracleAS Web Cache to 10g Release 2 (10.1.2), including information about upgrading cache cluster members

  • Chapter 13 for more information about invalidation


Methods for Sending Requests

As shown in Figure 13-3, you send invalidation requests using one of the following methods:

  • Manually, using Oracle Enterprise Manager 10g Application Server Control Console, OracleAS Web Cache Manager, or telnet

  • Automatically, using database triggers, scripts, or application logic

Specifically, you can use one of the following methods:

Telnet to Send Invalidation Requests

When you send an invalidation request with an HTTP POST request, you specify the host name of OracleAS Web Cache, the invalidation listening port number, and the invalidation request.

For example, if you are using telnet, you send an invalidation request using the following procedure:

  1. Connect to OracleAS Web Cache at the invalidation listening port:

    telnet web_cache_host invalidation_port
    
    
  2. Specify a POST message header and authenticate the invalidator account using Base64 encoding string with the following syntax:

    POST /x-oracle-cache-invalidate http/1.0|1
    Authorization: BASIC <base64 encoding of invalidator:invalidator_password> 
    content-length:#bytes
    
    

    The following shows an example of the Authorization line:

    Authorization: BASIC aW52YWxpZGF0b3I6aW52YWxpZGF0b3I= 
    
    

    In this example, aW52YWxpZGF0b3I6aW52YWxpZGF0b3I= is the invalidator user name and password (invalidator:invalidator) encoded.


    See Also:

    • http://www.rfc-editor.org/ for information about password Base64 encoding

    • readme.examples.html in the $ORACLE_HOME/webcache/docs directory on UNIX and ORACLE_HOME\webcache\docs directory on Windows for further information about using the EncodeBase64.java script to generate the Base64 string for invalidator:invalidator_password

    • "Task 2: Modify Security Settings" for further information about changing the invalidation password


  3. Enter one carriage return.

  4. Send the invalidation request with XML syntax.

Invalidation request syntax is described in the following sections:

Invalidation Request Syntax

Use the following syntax to invalidate objects contained within an exact URL that includes the complete path and file name:

<?xml version="1.0"?>
<!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATION VERSION="WCS-1.1">
   <SYSTEM>
    <SYSTEMINFO NAME="name" VALUE="value"/>
   </SYSTEM>  
   <OBJECT>
     <BASICSELECTOR URI="URL"/>
     <ACTION REMOVALTTL="TTL"/>
     <INFO VALUE="value"/>
   </OBJECT>
</INVALIDATION>

Use the following syntax to invalidate objects based on more advanced invalidation selectors:

<?xml version="1.0"?>
<!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATION VERSION="WCS-1.1">
   <SYSTEM>
    <SYSTEMINFO NAME="name" VALUE="value"/>
   </SYSTEM>  
   <OBJECT>
     <ADVANCEDSELECTOR URIPREFIX="prefix"
                       URIEXP="URL_expression"
                       HOST="host_name:port"
                       METHOD="HTTP_request_method"
                       BODYEXP="HTTP_body"/>
       <COOKIE NAME="cookie_name" VALUE="value"/>
       <HEADER NAME="HTTP_request_header" VALUE="value"/>
       <OTHER NAME="URI|BODY|QUERYSTRING_PARAMETER|SEARCHKEY"
             TYPE="SUBSTRING|REGEX"
             VALUE="value"/>
     </ADVANCEDSELECTOR>
     <ACTION REMOVALTTL="TTL"/>
     <INFO VALUE="value"/>
   </OBJECT>
</INVALIDATION>

The body of a valid invalidation request must begin with the following:

<?xml version="1.0"?>
<!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">

The first line denotes version 1.0 of XML. The second line denotes that the request is an invalidation request using the WCSinvalidation.dtd file as the XML document type. WCSinvalidation.dtd is the Document Type Definition (DTD) that defines the grammar of invalidation requests and responses.

Note the following:

  • No white space is allowed before "<?xml".

  • If an application is sharing invalidation requests with a third-party XML parser, replace "internal:///WCSinvalidation.dtd" with the following path:

    "http://www.oracle.com/webcache/90400/WCSinvalidation.dtd"
    
    

The root element INVALIDATION contains one or more of the attributes and elements described in Table 13-1.

Table 13-1 INVALIDATION Elements and Attributes

Invalidation Element/Attribute Description

VERSION attribute

Required attribute in the INVALIDATION element

Denote the version of the WCSinvalidation.dtd file to use as the XML document type.

For versions 9.0.x and later, always use VERSION="WCS-1.1", unless you require previous existing applications to remain unchanged. For these applications, you can use VERSION="WCS-1.0", but the new invalidation functionality will not be available.

SYSTEM element

Optional element in the INVALIDATION element. The SYSTEM element requires the SYSTEMINFO element.

SYSTEMINFO element

Required element in the SYSTEM element

The possible NAME/VALUE pairs are:

  • NAME="WCS_PROPAGATE" VALUE="TRUE|FALSE"

    This pair specifies whether or not invalidation requests are propagated to cache cluster members. If WCS_PROPAGATE is TRUE, it overrides the setting for invalidation propagation in the configuration. If WCS_PROPAGATE is FALSE, it uses the setting specified in the configuration.

    The default is FALSE.

  • NAME="WCS_DISCONNECTED_MODE_OK" VALUE="TRUE|FALSE"

    This pair specifies how soon invalidation takes place. If WCS_DISCONNECTED_MODE_OK is TRUE, invalidation is not immediately performed. The invalidation response is sent as soon as the invalidation request is received. Set this element to TRUE, if you do not want to wait for the invalidation result. If WCS_DISCONNECTED_MODE_OK is FALSE, invalidation is completed immediately and the invalidation result is sent.

    The default is FALSE.

OBJECT element

Required element in the invalidation request. You can specify more than one OBJECT element in the request.

BASICSELECTOR element

URI attribute: Required attribute of the BASICSELECTOR element. Specify the URL of the objects to be invalidated. Use one of the following formats:

  • http://host_name:port/path/filename

  • https://host_name:port/path/filename

host_name:port is not required if the administrator account is sending the request.

ADVANCEDSELECTOR element

URIPREFIX attribute: Required attribute of the ADVANCEDSELECTOR element. Specify the path prefix of the objects to be invalidated. The path prefix must begin with http|https://host_name:port/path/filename or "/" and end with "/". host_name:port is required if the HOST attribute is not specified and the invalidator account is sending the request.

The prefix is interpreted literally, including reserved regular expression characters. These characters include periods (.), question marks (?), asterisks (*), brackets ([]), curly braces ({}), carets (^), dollar signs ($), and backslashes (\).

 


URIEXP attribute: Optional attribute of the ADVANCEDSELECTOR element. Specify the URL of the objects to be invalidated underneath the URIPREFIX. If no value is entered, everything under the URIPREFIX will be matched.

Regular expression characters are permitted. To interpret these characters literally, escape them with a backslash (\).

Notes:

  • The request URL that client browsers send to OracleAS Web Cache and the URL that OracleAS Web Cache uses internally for that request are different. When OracleAS Web Cache serves a page request, it alphabetically sorts any embedded URL parameters of the URL. However, the invalidation requests are matched against only the internal representation of the URL in which any embedded URL parameters are sorted. To ensure invalidation requests are matched correctly, sort and enter the embedded URL parameters alphabetically.

  • When the invalidation request is sent, OracleAS Web Cache performs a regular expression match of URIEXP. This can take processing time. As an alternative, you can use the OTHER element to specify a substring match rather than a regular expression match.

 


HOST attribute: This attribute is required if the URIPREFIX value does not include host_name:port and the invalidator account is sending the request. Specify the host name and port number of the site (host_name:port). Port 80 is the default port for HTTP.

 


METHOD attribute: Optional attribute of the ADVANCEDSELECTOR element. Specify HTTP request method (GET or POST) of the objects to be invalidated. GET is the default value.

 


BODYEXP attribute: Optional attribute of the ADVANCEDSELECTOR element. If the METHOD is POST, specify HTTP POST body of the objects to be invalidated.

Note: When the invalidation request is sent, OracleAS Web Cache performs a regular expression match of BODYEXP. This can take processing time. As an alternative, you can use the OTHER element to specify a substring match rather than a regular expression match.

COOKIE element

Optional element in the invalidation request. Use the following attributes:

  • NAME attribute: Required attribute for the COOKIE element attribute. Specify the cookie name to invalidate multiple-version objects based on the cookie.

  • VALUE attribute: Optional attribute for the COOKIE element. Specify the value of the cookie. If no value is present, only objects with the named cookie but without a value are invalidated.

If you specify a cookie that was mistakenly specified for both a multiple-version object and a session caching policy, invalidation is based on any occurrence of the cookie. To avoid excessive invalidation, configure distinct cookies for multiple-version objects and session caching policies.

See Also:

HEADER element

Optional element in the invalidation request. Use the following attributes:

  • NAME attribute: Required attribute for the HEADER element. Specify the HTTP request header and its value to invalidate based multiple-version objects based on the request header.

  • VALUE attribute: Optional attribute for the HEADER element. Specify the value of the header.

See Also: "Task 1: Create Caching Rules" to create caching rules for multiple-version objects

OTHER element

Optional element in the invalidation request. Use the following attributes:

  • NAME attribute: Required attribute of the OTHER element. NAME supports the following values:

    - URI to specify a match of the URL underneath the URIPREFIX

    - BODY to specify a match of the HTTP POST body

    - QUERYSTRING_PARAMETER to specify a match of an embedded URL parameter

    - SEARCHKEY to specify a match of a search key in the Surrogate-Key response header

  • TYPE attribute: Required attribute for URI, BODY, and QUERYSTRING_PARAMETER. This attribute is not recognized for SEARCHKEY. TYPE supports the following values:

    - SUBSTRING to specify an exact string match for QUERYSTRING_PARAMETER and a substring match for URI and BODY.

    - REGEX to specify a regular expression match

  • VALUE attribute: Required attribute for URI, BODY, QUERYSTRING_PARAMETER, and SEARCHKEY. Specify the value of URI, BODY, QUERYSTRING_PARAMETER, or SEARCHKEY. If you specify a TYPE of REGEX, then escape regular expression characters that you want to interpreted literally with a backslash (\).

See Also:

ACTION element

Required element in the invalidation request

REMOVALTTL attribute

Optional attribute of the ACTION element. Specify the maximum time that objects can reside in the cache before they are invalidated. The default is 0 seconds.

INFO element

Optional element in the invalidation request

VALUE attribute

Required attribute of the INFO element. Specify a comment to be included in the invalidation result. After the invalidation request is complete, the message that contains the comment, along with the result of the invalidation, is written to the event log:

[13/Jul/2005:19:26:46 +0000] [notification 11748] [invalidation] [ecid: 21085932167,0] Invalidation with INFO 'INFO_comment' has returned with status 'status'; number of objects invalidated: 'number'.


Note:

The following special XML characters must be escaped in the fields: ampersand (&) with "&amp;", greater than sign (>) with "&gt", less than sign (<) with "&lt", double quotes (") with "&quot", and single quotes (') with "&apos;".


Note:

OracleAS Web Cache continues to support invalidation requests sent in the following release 1.0 format:
<?xml version="1.0"?>
<!DOCTYPE INVALIDATION SYSTEM "internal:///invalidation.dtd">
<INVALIDATION>
   <URL EXP="URL" PREFIX="YES|NO">
               <VALIDITY LEVEL="validity" REFRESHTIME="seconds"/>
               <COOKIE NAME="cookie_name" 
                       VALUE="value"   
                       NONEXIST="YES|NO"/>
               <HEADER NAME="HTTP_request_header" VALUE="value"/>
   </URL>
</INVALIDATION>


See Also:

"Invalidation Request and Response DTD" for further information about invalidation request syntax

Invalidation Response Syntax

Invalidation responses are returned in the following format for BASICSELECTOR invalidation requests:

<?xml version="1.0"?> 
<!DOCTYPE INVALIDATIONRESULT SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATIONRESULT VERSION="WCS-1.1">
   <SYSTEM>
     <SYSTEMINFO NAME="name" VALUE="value"/>
   </SYSTEM>  
   <OBJECTRESULT>
     <BASICSELECTOR URI="URL">
     </BASICSELECTOR>
     <RESULT ID="ID" STATUS="status" NUMINV="number"/>
     <INFO VALUE="value"/>
   </OBJECTRESULT>
</INVALIDATIONRESULT>

Invalidation responses are returned in the following format for ADVANCEDSELECTOR invalidation requests:

<?xml version="1.0"?> 
<!DOCTYPE INVALIDATIONRESULT SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATIONRESULT VERSION="WCS-1.1">
   <SYSTEM>
     <SYSTEMINFO NAME="name" VALUE="value"/>
   </SYSTEM>  
   <OBJECTRESULT>
    <ADVANCEDSELECTOR URIPREFIX="prefix"
                      URIEXP="URL_expression"
                      HOST="host_name:port"
                      METHOD="HTTP_request_method"
                      BODYEXP="HTTP_body"/>
      <COOKIE NAME="cookie_name" VALUE="value"/>
      <HEADER NAME="HTTP_request_header" VALUE="value"/>
      <OTHER NAME="URI|BODY|QUERYSTRING_PARAMETER|SEARCHKEY"
             TYPE="SUBSTRING|REGEX"
             VALUE="value"/>
     </ADVANCEDSELECTOR>
     <RESULT ID="ID" STATUS="status" NUMINV="number"/>
     <INFO VALUE="value"/>
   </OBJECTRESULT>
</INVALIDATIONRESULT>

The body of a valid invalidation response begins with the following:

<?xml version="1.0"?>
<!DOCTYPE INVALIDATIONRESULT SYSTEM "internal:///WCSinvalidation.dtd">

The first line denotes version 1.0 of XML. The second line denotes the response is an invalidation response using the WCSinvalidation.dtd file as the XML document type.

The root element INVALIDATIONRESULT contains one or more of the attributes and elements described in Table 13-2. BASICSELECTOR and ADVANCEDSELECTOR are described in Table 13-1.

Table 13-2 INVALIDATIONRESULT Elements and Attributes

Invalidation Element/Attribute Description

VERSION attribute

Version number of the WCSinvalidation.dtd file to use as the XML document type

SYSTEM element

Optional element in the INVALIDATIONRESULT element.

The SYSTEM element is optional. The SYSTEM element requires the SYSTEMINFO element.

SYSTEMINFO element

Required element in the SYSTEM element.

The possible NAME/VALUE pairs are as follows:

  • NAME="WCS_CACHE_NAME" VALUE="string"

    This pair specifies the name of the cache.

  • NAME="WCS_DISCONNECTED_MODE_OK" VALUE="TRUE|FALSE"

    This pair specifies how soon invalidation takes place. If WCS_DISCONNECTED_MODE_OK is TRUE, invalidation is not immediately performed. The invalidation response is sent as soon as the invalidation request is received. Set this element to TRUE, if you do not want to wait for the invalidation result. If WCS_DISCONNECTED_MODE_OK is FALSE, invalidation is completed immediately and the invalidation result is sent.

    The default is FALSE.

RESULT element

Use the following attributes:

  • ID attribute: Sequence number of all the invalidation objects sent in the invalidation response. If there are multiple selectors specified in the invalidation request, the sequence number starts at 1 for the first URL and continues sequentially for each additional selector.

  • STATUS attribute: Status of the invalidation. Status is one of the following:

    - SUCCESS for successful invalidations

    - URI NOT CACHEABLE for objects that are not cacheable

    - URI NOT FOUND for objects not found

  • NUMINV attribute: Number of objects invalidated during the invalidation request

INFO element

Returns the comment specified in the INFO element of the invalidation request



See Also:

"Invalidation Request and Response DTD" for further information about invalidation response syntax

Invalidation Preview Request Syntax

To test invalidation, use the following syntax to preview the list of BASICSELECTOR objects to be invalidated:

<?xml version="1.0"?>
<!DOCTYPE INVALIDATIONPREVIEW SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATIONPREVIEW VERSION="WCS-1.1" STARTNUM="start_number" MAXNUM="max_number">
     <BASICSELECTOR URI="URL"/>
</INVALIDATIONPREVIEW>

Use the following syntax to preview the list of ADVANCEDSELECTOR objects to be invalidated:

<?xml version="1.0"?>
<!DOCTYPE INVALIDATIONPREVIEW SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATIONPREVIEW VERSION="WCS-1.1" STARTNUM="start_number" MAXNUM="max_number">
    <ADVANCEDSELECTOR URIPREFIX="prefix"
                      URIEXP="URL_expression"
                      HOST="host_name:port"
                      METHOD="HTTP_request_method"
                      BODYEXP="HTTP_body"
      <COOKIE NAME="cookie_name" VALUE="value"/>
      <HEADER NAME="HTTP_request_header" VALUE="value"/>
      <OTHER NAME="URI|BODY|QUERYSTRING_PARAMETER|SEARCHKEY"  
             TYPE="SUBSTRING|REGEX"
             VALUE="value"/>
    </ADVANCEDSELECTOR>
</INVALIDATIONPREVIEW>

The body of a valid invalidation preview request must begin with the following:

<?xml version="1.0"?>
<!DOCTYPE INVALIDATIONPREVIEW SYSTEM "internal:///WCSinvalidation.dtd">

The first line denotes version 1.0 of XML. The second line denotes the request is an invalidation preview request using the WCSinvalidation.dtd file as the XML document type.

The root element INVALIDATIONPREVIEW contains one or more of the attributes described in Table 13-3. BASICSELECTOR and ADVANCEDSELECTOR are described in Table 13-1.

Table 13-3 INVALIDATIONPREVIEW Attributes

Invalidation Element/Attribute Description

VERSION attribute

Required attribute in the invalidation preview

Use VERSION="WCS-1.1" as the version of the WCSinvalidation.dtd file to use as the XML document type.

STARTNUM attribute

Required attribute in the invalidation preview

Enter the number representing the first object to be listed. OracleAS Web Cache begins the count of objects with the number 0.

MAXNUM attribute

Required attribute in the invalidation preview

Enter the number of objects to be listed.

If fewer objects than the number specified meet the invalidation criteria, OracleAS Web Cache lists only the URLs for those objects that meet the criteria.

If more objects than the number specified meet the invalidation criteria, OracleAS Web Cache lists the URLs for the number of objects requested. It also returns the total number of objects that meet the invalidation criteria. To obtain the list of URLs for addition objects, send another preview request with a different STARTNUM that specifies the start of the next set of objects.


Invalidation Preview Response Syntax

Invalidation preview responses for preview requests are returned in the following format:

<?xml version="1.0"?> 
<!DOCTYPE INVALIDATIONPREVIEWRESULT SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATIONPREVIEWRESULT VERSION="WCS-1.1" STATUS="status" NUMURLS="number" TOTALNUMURLS="total_number">
   <SELECTURL VALUE="URL">
   </SELECTEDURL>
</INVALIDATIONPREVIEWRESULT>

The body of a valid invalidation preview response begins with the following:

<?xml version="1.0"?> 
<!DOCTYPE INVALIDATIONPREVIEWRESULT SYSTEM "internal:///WCSinvalidation.dtd">

The first line denotes version 1.0 of XML. The second line denotes that the response is an invalidation preview response using the WCSinvalidation.dtd file as the XML document type.

Note the following:

  • No white space is allowed before "<?xml".

  • If an application is sharing invalidation requests with a third-party XML parser, replace "internal:///WCSinvalidation.dtd" with the following path:

    "http://www.oracle.com/webcache/90400/WCSinvalidation.dtd"
    
    

The root element INVALIDATIONPREVIEWRESULT contains one or more of the attributes and elements described in Table 13-4. BASICSELECTOR and ADVANCEDSELECTOR are described in Table 13-1.

Table 13-4 INVALIDATIONPREVIEWRESULT Elements and Attributes

Invalidation Element/Attribute Description

VERSION attribute

Version number of the WCSinvalidation.dtd file to use as the XML document type

STATUS attribute

Status of the preview. Status can be one of the following:

  • SUCCESS for successful invalidations

  • URI NOT CACHEABLE for objects that are not cacheable

  • URI NOT FOUND for objects not found

STARTNUM attribute

Number representing the first object to be listed

NUMURLS attribute

Number of URLs returned in this preview result

TOTALNUMURLS attribute

Number of URLs matching the BASICSELECTOR or ADVANCEDSELECTOR selectors

SELECTEDURL element

URLs matching the BASICSELECTOR or ADVANCEDSELECTOR selectors to be invalidated


Oracle Enterprise Manager 10g Application Server Control Console or OracleAS Web Cache Manager to Send Invalidation Requests

Application Server Control Console or OracleAS Web Cache Manager provides an easy-to-use interface for invalidating cached objects. The message mechanics are much like the telnet example. The advantage of using one of these interface is that the administrator is isolated from the intricacies of the HTTP and XML formats, and consequently, there is less chance for error. The administrator need only specify which objects to invalidate and how invalid those objects should be.

Application Server Control Console provides a step-by-step wizard that guides you through the invalidation process. To get started, navigate to Web Cache Home page > Administration tab > Operations > Invalidation. Use the online help for the wizard pages for further assistance.

OracleAS Web Cache Manager enables you to send either basic invalidation request for invalidation one object, or an advanced invalidation request for multiple objects, as described in the following topics:


Note:

If you receive the following error when you submit invalidation requests from the Basic Content Invalidation or Advanced Content Invalidation pages, restart the cache or admin server processes.

Internal error: can't connect to OracleAS Web Cache Invalidation Listening Port

If you change the property of an invalidation port, restart the cache server process. If you change the password for the administrator account in the Security page, restart the cache and admin server process. Until your restart the cache server process for either configuration change, invalidation requests will return the error.

See Chapter 7 for restart instructions.


Submitting Basic Invalidation Requests

To send a basic invalidation request using OracleAS Web Cache Manager:

  1. In the navigator frame, select Operations > Basic Content Invalidation.

    The Basic Content Invalidation page appears in the right pane.

  2. From the For Cache list, select a cache. (More than one cache is listed only if you configured a cache cluster. If you configured the cluster to propagate invalidation, the cache you select is designated the invalidation coordinator, which will propagate the invalidation request to other cache cluster members. If you did not configure the cluster to propagate invalidation, the cache you select is the only cache from which objects are invalidated.)

  3. In the Search Criteria section, select the search criteria:

    • Remove all cached objects: Select to remove all objects from the cache.

    • Enter exact URL for removal: Specify the URL of the objects to be invalidated. Include the complete path and file name.

      Note: Because OracleAS Web Cache escapes the following characters, you can enter them in this field: ampersand (&), greater than sign (>), less than sign (<), double quotes ("), and single quotes (').

  4. Optionally, you can preview the list of objects to be invalidated to ensure that you are removing only the objects you want to remove. To preview the list of objects:

    1. In the Action section, choose Preview list of objects that match invalidation criteria.

    2. Specify the Object Range:

      • From: Enter the number representing the first object to be listed. OracleAS Web Cache begins the count of objects with the number 0.

      • To: Enter the number of objects to be listed.

        If fewer objects than the number specified meet the invalidation criteria, OracleAS Web Cache lists the URLs for only those objects that meet the criteria.

        If more objects than the number specified meet the invalidation criteria, OracleAS Web Cache lists the URLs for the number of objects requested. It also returns the total number of objects that meet the invalidation criteria. To obtain the list of URLs for addition objects, send another preview request with a different From number that specifies the start of the next set of objects.

    3. Click Submit.

      OracleAS Web Cache displays the Invalidation Preview Results message box, which lists the objects that meet the invalidation criteria. OracleAS Web Cache Manager lists only those objects that are valid. Although the cache may contain objects that are expired or that have been invalidated, those objects are not listed.

      If the objects listed are those that you want to invalidate, continue with the next step. If they are not, modify the invalidation criteria and preview the list again.

  5. In the Action section, select one of the following options to specify how to process invalid objects:

    • Remove immediately: OracleAS Web Cache marks objects as invalid and removes them immediately. A object is refreshed from the origin server when the cache receives the next request for it.

    • Remove objects no later than <number> <time> after submission: OracleAS Web Cache marks objects as invalid and then refreshes them based on origin server capacity. Enter the maximum time in which the objects can reside in the cache.


      Note:

      Performance assurance heuristics apply when you configure objects to be refreshed based on when the origin servers can refresh them; performance assurance heuristics do not apply when objects are immediately removed.

  6. Click Submit.

OracleAS Web Cache processes the invalidation request, and returns the Cache Cleanup Result dialog box that the shows the invalidation status and the number of objects invalidated. The following figure shows the dialog box:

Description of invalid.gif follows
Description of the illustration invalid.gif

In a cache cluster environment, if Propagate Invalidation is enabled, OracleAS Web Cache sends the invalidation request to one cluster member who acts as the invalidation coordinator. The coordinator propagates the invalidation request to other cluster members. When the invalidation has been completed for all cluster members, OracleAS Web Cache returns a Cache Cleanup box, that lists, for each cluster member, the cache name, the status of the invalidation request, and the number of objects invalidated.


See Also:


Submitting Advanced Invalidation Requests

To send an advanced invalidation request using OracleAS Web Cache Manager:

  1. In the navigator frame, select Operations > Advanced Content Invalidation.

    The Advanced Content Invalidation page appears in the right pane.

  2. From the For Cache list, select a cache. (More than one cache is listed only if you configured a cache cluster.)

  3. In the Search Criteria section, select the search criteria:


    Note:

    Because OracleAS Web Cache escapes the following characters, you can enter them in the search criteria fields: ampersand (&), greater than sign (>), less than sign (<), double quotes ("), and single quotes (').

    • URL Path Prefix: Required. Specify the path prefix of the objects to be invalidated. The path prefix must begin with http|https://host_name:port/path/filename or with "/" and end with "/".

      host_name:port is optional. You can also specify the site host name and port in the Host Name field.

      The prefix is interpreted literally, including reserved regular expression characters. These characters include periods (.), question marks (?), asterisks (*), brackets ([]), curly braces ({}), carets (^), dollar signs ($), and backslashes (\).

    • Host Name: Optional. Specify the host name and port number of the site (host_name:port). Port 80 is the default port for HTTP.

      This field is required if the URL Path Prefix does not include http|https://host_name:port/path/filename.

    • HTTP Method: Optional. Select the HTTP request method (GET or POST) of the objects to be invalidated. The default value is GET.

    • URL Expression: Optional. Specify the URL of the objects to be invalidated under the URL Path Prefix. Then, specify how to match by selecting either substring for an exact string match or regular expression for a regular expression match.

      If no value is entered, everything under the URL Path Prefix is matched.

    • POST Body Expression: Optional. If POST is selected for the HTTP Method, enter the HTTP POST body of the objects to be invalidated, and then specify how to match by selecting either substring for a substring string match or regular expression for a regular expression match.


      Note:

      If regular expression is selected for the URL Expression or POST Body Expression fields, OracleAS Web Cache interprets the following reserved regular expression characters: periods (.), question marks (?), asterisks (*), brackets ([]), curly braces ({}), carets (^), dollar signs ($), and backslashes (\). To interpret these characters literally, escape them with a backslash (\).

  4. Optionally, in the Cookie/Header Information section, specify the use of cookie names or HTTP request headers used for multiple-version objects in the search criteria:

    1. From the list, select Cookie or Header.

    2. Provide the following information:

      • Cookie: Enter the cookie name used by multiple-version objects to be invalidated in the Name field, and enter its value in the Value field.


        Note:

        If you specify a cookie that was mistakenly specified for both a multiple-version object and a session caching policy, invalidation is based on any occurrence of the cookie. To avoid excessive invalidation, configure distinct cookies for multiple-version objects (Rules for Caching, Personalization, and Compression > Cookie Definitions) and session caching policies (Rules for Caching, Personalization, and Compression > Session Definitions).

      • Header: Enter the HTTP request header used by the objects to be invalidated in the Name field, and enter its value in the Value field.


    See Also:

    "Task 1: Create Caching Rules" to create caching rules for multiple-version objects

  5. Optionally, in the URL Parameters section, enter the name of the embedded URL parameter used by the objects to be invalidated in the Name field, enter its value in the Value field, and then specify how to match by selecting either exact strings or regular expression.

  6. Optionally, in the Search Keys section, enter the name of a search key from the Surrogate-Key response-header field used by the objects to be invalidated in the Key field.

  7. Optionally, you can preview the list of objects to be invalidated to ensure that you are removing only the objects you want to remove. To preview the list of objects:

    1. In the Action section, choose Preview list of objects to be removed.

    2. Specify the Object Range:

      • From: Enter the number representing the first object to be listed. OracleAS Web Cache begins the count of objects with the number 0.

      • To: Enter the number of objects to be listed.

      If fewer objects than the number specified meet the invalidation criteria, OracleAS Web Cache lists the URLs for only those objects that meet the criteria.

      If more objects than the number specified meet the invalidation criteria, OracleAS Web Cache lists the URLs for the number of objects requested. It also returns the total number of objects that meet the invalidation criteria. To obtain the list of URLs for addition objects, send another preview request with a different From number that specifies the start of the next set of objects.

    3. Click Submit.

      OracleAS Web Cache displays the Invalidation Preview Results message box, which lists the objects that meet the invalidation criteria. OracleAS Web Cache Manager lists only those objects that are valid. Although the cache may contain objects that are expired or that have been invalidated, those objects are not listed.

      If the objects listed are those that you want to invalidate, continue with the next step. If they are not, modify the invalidation criteria and preview the list again.

  8. In the Action section, select one of the following options to specify how to process invalid objects:

    • Remove immediately: OracleAS Web Cache marks objects as invalid and then removes them immediately. A object is refreshed from the origin server when the cache receives the next request for it.

    • Remove objects no later than <number> <time> after submission: OracleAS Web Cache marks objects as invalid and then refreshes them based on origin server capacity. Enter the maximum time in which the objects can reside in the cache.


      Note:

      Performance assurance heuristics apply when you configure objects to be refreshed based on when the application Web servers can refresh them; performance assurance heuristics do not apply when objects are immediately removed.

  9. Click Submit.

OracleAS Web Cache processes the invalidation request, and returns a Cache Cleanup dialog box that the shows the invalidation status and the number of objects invalidated.


Note:

For prefix-based invalidations that require OracleAS Web Cache to traverse a complex directory structure, invalidation can take some time. Therefore, do not click Submit again until the Cache Cleanup Result dialog box appears. Creating a queue of invalidation requests can degrade the performance of OracleAS Web Cache.

Application Program Interfaces (APIs) for Automated Invalidation Requests

Invalidation requests can originate from a Web site's underlying application logic or from the content management application used to design Web pages.

OracleAS Web Cache ships with the following Application Program Interfaces (APIs) that you can implement:

  • jawc.jar for a Java invalidation API

  • wxvutil.sql and wxvappl.sql for a PL/SQL invalidation API

    These APIs are located in the $ORACLE_HOME/webcache/toolkit directory on UNIX and ORACLE_HOME\webcache\toolkit directory on Windows


    See Also:


OracleAS Web Cache also ships with the following sample code for generating invalidation requests. You can create invalidation tools following these examples and use them with your applications.

  • EncodeBase64.java for encoding the password using Base 64 encoding

  • invalidate.c for C source

  • Invalidate.java or WCSInvalidate.java for Java source

  • invalidate.sh for a shell script that invalidates objects with a telnet session

  • invalidate.pl for PERL source

  • Invalidate.sql for PL/SQL source

These files are located in the $ORACLE_HOME/webcache/examples directory on UNIX and ORACLE_HOME\webcache\examples directory on Windows.


See Also:

readme.examples.html in the $ORACLE_HOME/webcache/docs directory on UNIX and ORACLE_HOME\webcache\docs directory on Windows for further information about these files

Database Triggers for Automated Invalidation Requests

Database triggers are procedures that are stored in the database and activated ("fired") when specific conditions occur, such as adding a row to a table. You can use triggers to send invalidation requests. To do this, use the UTL_TCP Oracle supplied package to send invalidation requests through database triggers.


See Also:

  • readme.examples.html in the $ORACLE_HOME/webcache/docs directory on UNIX and ORACLE_HOME\webcache\docs directory on Windows for further information about using the cre_invalid_trig.sql script to create a database trigger and the utl_proc.sql script to demonstrate invalidation with database triggers

  • Oracle PL/SQL documentation


Scripts for Automated Invalidations

Many Web sites use scripts for uploading new content to databases and file systems. A large online book retailer, for instance, might run a PERL script once a day to bulk load new book listings and price changes into its catalog database. The retailer would want the price changes and availability listings to be reflected in the item views and search results currently cached in OracleAS Web Cache. To achieve this, the PERL script can be modified such that when the bulk loading operation has completed, the script will send an invalidation request to the cache invalidating all catalog views and search results. (Note that the invalidation request need not list every individual search page or item view that might be effected by the data change.) The performance assurance feature of OracleAS Web Cache enables administrators to use broad brush strokes when invalidating content, making it safe to invalidate all catalog content even if only a fraction of that content has changed.

Invalidation Examples

This section contains the following invalidation request examples:

The examples in this section require using the POST method which also requires sending the number of bytes (or characters) in the content_length: #bytes portion of the header. Please note that one carriage return is required after the content_length: #bytes line and before the XML request or BODY information.

Example: Invalidating One Object

The following request invalidates the file /images/logo.gif:

<?xml version="1.0"?>
<!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATION VERSION="WCS-1.1">
   <OBJECT>
     <BASICSELECTOR URI="http://www.company.com:80/images/logo.gif"/>
     <ACTION/>
   </OBJECT>
</INVALIDATION>

Invalidation response:

<?xml version="1.0"?> 
<!DOCTYPE INVALIDATIONRESULT SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATIONRESULT VERSION="WCS-1.1">
   <OBJECTRESULT>
     <BASICSELECTOR URI="http://www.company.com:80/images/logo.gif"/>
     <RESULT ID="1" STATUS="SUCCESS" NUMINV="1"/>
     </OBJECTRESULT>
</INVALIDATIONRESULT>

The following request invalidates an object exactly matching /contacts/contacts.html using the BASICSELECTOR element:

<?xml version="1.0"?>
<!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATION VERSION="WCS-1.1">
  <OBJECT>
    <BASICSELECTOR URI="http://www.company.com:80/contacts/contacts.html"/>
    <ACTION REMOVALTTL="0"/>
  </OBJECT>
</INVALIDATION>
    

This request is equivalent to the following request using the ADVANCEDSELECTOR element. This request specifies the site information in the HOST attribute.

<?xml version="1.0"?>
<!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATION VERSION="WCS-1.1">
  <OBJECT>
    <ADVANCEDSELECTOR URIPREFIX="/contacts/" URIEXP="^/contacts/contacts\.html$" HOST="www.company.com:80"/>
    <ACTION REMOVALTTL="0"/>
  </OBJECT>
</INVALIDATION>

The second request specifies the site information in the URIPREFIX attribute:

<?xml version="1.0"?>
<!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATION VERSION="WCS-1.1">
  <OBJECT>
    <ADVANCEDSELECTOR URIPREFIX="http://www.company.com/contacts/" URIEXP="^/contacts/contacts\.html$"/>
    <ACTION REMOVALTTL="0"/>
  </OBJECT>
</INVALIDATION>
    

The ADVANCEDSELECTOR element uses the URIPREFIX attribute. This attribute is used to traverse the directory structure. The quicker invalidation reaches the right tree level, the quicker the invalidation process is done. The request with the BASICSELECTOR element is the more efficient of the two examples because there is no directory structure traversal involved.

Example: Invalidating Multiple Objects

The following request invalidates two different objects, summary.jsp and summary.gif. In addition, the request provides the comments "summary.jsp" and "summary.gif" to be included in the invalidation result and event log.

<?xml version="1.0"?>
<!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATION VERSION="WCS-1.1">
  <OBJECT>
    <ADVANCEDSELECTOR URIPREFIX="/global/sales/" URIEXP="summary.jsp\?year=2001" HOST="www.company.com:80"/>
      <COOKIE NAME="group" VALUE="asia"/>
    </ADVANCEDSELECTOR>
    <ACTION />
    <INFO VALUE="summary.jsp"/>
  </OBJECT>
  <OBJECT>
    <ADVANCEDSELECTOR URIPREFIX="/image/" URIEXP="summary.*\.gif$" HOST="www.company.com:80"/>
    <INFO VALUE="summary.gif"/>
    <ACTION />
  </OBJECT>
</INVALIDATION>

Invalidation response:

<?xml version="1.0"?> 
<!DOCTYPE INVALIDATIONRESULT SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATIONRESULT VERSION="WCS-1.1">
  <OBJECTRESULT>
    <ADVANCEDSELECTOR URIPREFIX="/global/sales/" URIEXP="summary.jsp\?year=2001" HOST="www.company.com:80"/>
      <COOKIE  NAME="group"  VALUE="asia"  />
    </ADVANCEDSELECTOR>
    <RESULT ID="1" STATUS="SUCCESS" NUMINV="2"/>
    <INFO VALUE="summary.jsp"/>
  </OBJECTRESULT>
  <OBJECTRESULT>
    <ADVANCEDSELECTOR URIPREFIX="/image/" URIEXP="summary.*\.gif$" HOST="www.company.com:80"/>
    </ADVANCEDSELECTOR>
    <RESULT ID="2" STATUS="SUCCESS" NUMINV="14"/>
    <INFO VALUE="summary.gif"/>
  </OBJECTRESULT>
</INVALIDATIONRESULT>

The following messages are written to the event log:

[13/Jul/2005:19:26:46 +0000] [notification 11748] [invalidation] [ecid:
 21085932167,0] Invalidation with INFO 'summary.jsp' has returned with status
 'SUCCESS'; number of objects invalidated: '2'.
.
.
.
[13/Jul/2005:19:26:46 +0000] [notification 11748] [invalidation] [ecid:
 21085932167,0] Invalidation with INFO 'summary.gif' has returned with status
 'SUCCESS'; number of objects invalidated: '14'.

Example: Invalidating a Subtree of Objects

The following request invalidates all objects under the /images/ directory:

<?xml version="1.0"?>
<!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATION VERSION="WCS-1.1">
   <OBJECT>
     <ADVANCEDSELECTOR URIPREFIX="/images/" HOST="www.company.com:80"/>
     <ACTION REMOVALTTL="0"/>
   </OBJECT>
</INVALIDATION>

Invalidation response:

<?xml version="1.0"?> 
<!DOCTYPE INVALIDATIONRESULT SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATIONRESULT VERSION="WCS-1.1">
   <OBJECTRESULT>
     <ADVANCEDSELECTOR URIPREFIX="/images/" HOST="www.company.com:80"/>
     <RESULT ID="1" STATUS="SUCCESS" NUMINV="125"/>
   </OBJECTRESULT>
</INVALIDATIONRESULT>

The following request invalidates all objects under the /contacts/ directory whose file names end in .html and uses cookie name cust with a value of oracle:

<?xml version="1.0"?>
<!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATION VERSION="WCS-1.1">
  <OBJECT>
    <ADVANCEDSELECTOR URIPREFIX="/contacts/" URIEXP="\.html$" HOST="www.company.com:80"/>
      <COOKIE NAME="cust" VALUE="oracle"/>
    </ADVANCEDSELECTOR>
    <ACTION REMOVALTTL="0"/>
  </OBJECT>
</INVALIDATION>

Invalidation response:

<?xml version="1.0"?> 
<!DOCTYPE INVALIDATIONRESULT SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATIONRESULT VERSION="WCS-1.1">
   <OBJECTRESULT>
     <ADVANCEDSELECTOR URIPREFIX="/contacts"/> URIEXP="\.html$" HOST="www.company.com:80"/>
      <COOKIE NAME="cust" VALUE="oracle"/>
     </ADVANCEDSELECTOR>
      <RESULT ID="1" STATUS="SUCCESS" NUMINV="45"/>
   </OBJECTRESULT>
</INVALIDATIONRESULT>

Example: Invalidating All Objects for a Web Site

The following request invalidates all objects under /.

<?xml version="1.0"?>
<!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATION VERSION="WCS-1.1">
   <OBJECT>
     <ADVANCEDSELECTOR URIPREFIX="/" HOST="www.company.com:80"/>
     <ACTION REMOVALTTL="0"/>
   </OBJECT>
</INVALIDATION>

Invalidation response:

<?xml version="1.0"?> 
<!DOCTYPE INVALIDATIONRESULT SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATIONRESULT VERSION="WCS-1.1">
   <OBJECTRESULT>
     <ADVANCEDSELECTOR URIPREFIX="/" HOST="www.company.com:80"/>
      <RESULT ID="1" STATUS="SUCCESS" NUMINV="17"/>
   </OBJECTRESULT>
</INVALIDATIONRESULT>

Example: Invalidating Objects Using Prefix Matching

To better understand the relationship of the URIPREFIX and URIEXP attributes, consider the examples that follow.

The following syntax invalidates sample.gif files within the /cec/cstage/graphic* directories:

<ADVANCEDSELECTOR URIPREFIX="/cec/cstage/"
   URIEXP="graphic.*/sample\.gif">
</ADVANCEDSELECTOR>

Note that ".*" in "graphic.*/sample\.gif" are regular expression characters that match all directories starting with graphic. The "." in "sample\.gif" is escaped for a literal interpretation.

The following syntax instructs OracleAS Web Cache to locate a directory named graphic*:

<ADVANCEDSELECTOR URIPREFIX="/cec/cstage/graphic*/" URIEXP="sample\.gif" HOST="www.company.com:80"/>
</ADVANCEDSELECTOR>

The following syntax invalidates objects contained within /cec/cstage?ecaction=viewitem:

<ADVANCEDSELECTOR URIPREFIX="/cec/" URIEXP="cstage\?ecaction=viewitem" HOST="www.company.com:80"/>
</ADVANCEDSELECTOR>

Note that "?" is escaped with a backslash.

URLs such as /cec/cstage?ecaction=viewitem&zip=94405 and /cec/cstage?ecaction=viewitem&zip=94305 match and are invalidated, but /usa/cec/cstage?ecaction=viewitem&zip=94209 does not match and is not invalidated.

Example: Invalidating Objects Using Substring and Query String Matching

The following request invalidates all objects under / matching the substrings /post/ and htm. In addition, the request provides the comment "remove-htm-under-all-post-dir" to be included in the invalidation result and event log.

<?xml version="1.0"?>
<!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATION VERSION="WCS-1.1">
  <OBJECT>
    <ADVANCEDSELECTOR URIPREFIX="/"
                      HOST="www.company.com:80">
      <OTHER NAME="URI" TYPE="SUBSTRING" VALUE="/post/"/>
      <OTHER NAME="URI" TYPE="SUBSTRING" VALUE="htm"/>
    </ADVANCEDSELECTOR>
    <ACTION REMOVALTTL="0" />
    <INFO VALUE="remove-htm-under-all-post-dir"/>
  </OBJECT>
</INVALIDATION>

Invalidation response:

<?xml version="1.0"?> 
<!DOCTYPE INVALIDATIONRESULT SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATIONRESULT VERSION="WCS-1.1">
   <OBJECTRESULT>
     <ADVANCEDSELECTOR URIPREFIX="/" HOST="www.company.com:80"/>
       <OTHER NAME="URI" TYPE="SUBSTRING" VALUE="/post/"/>
       <OTHER NAME="URI" TYPE="SUBSTRING" VALUE="htm"/>      
      <RESULT ID="1" STATUS="SUCCESS" NUMINV="52"/>
      <INFO VALUE="remove-htm-under-all-post-dir"/>
   </OBJECTRESULT>
</INVALIDATIONRESULT>

The following message is written to the event log:

[13/Jul/2005:19:26:46 +0000] [notification 11748] [invalidation] [ecid:
 21085932167,0] Invalidation with INFO 'remove-htm-under-all-post-dir has
 returned with status 'SUCCESS'; number of objects invalidated: '12'.

The following request invalidates all objects under /corporate/asp/, matching the substring /view_building.asp and the embedded URL parameter value pairs of building=8 and floor=10. In addition, the request provides the comment "remove-view-building8-10th-floor" to be included in the invalidation result and event log.

<?xml version="1.0"?>
<!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATION VERSION="WCS-1.1">
  <OBJECT>
    <ADVANCEDSELECTOR URIPREFIX="/corporate/asp/"
                      HOST="www.company.com:80">
      <OTHER NAME="URI" TYPE="SUBSTRING" VALUE="/view_building.asp"/>
      <OTHER NAME="QUERYSTRING_PARAMETER" TYPE="SUBSTRING" VALUE="building=8"/>
      <OTHER NAME="QUERYSTRING_PARAMETER" TYPE="SUBSTRING" VALUE="floor=10"/>
    </ADVANCEDSELECTOR>
    <ACTION REMOVALTTL="0" />
    <INFO VALUE="remove-view-building8-10th-floor"/>
  </OBJECT>
</INVALIDATION>

Invalidation response:

<?xml version="1.0"?> 
<!DOCTYPE INVALIDATIONRESULT SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATIONRESULT VERSION="WCS-1.1">
   <OBJECTRESULT>
     <ADVANCEDSELECTOR URIPREFIX="/" HOST="www.company.com:80"/>
       <OTHER NAME="URI" TYPE="SUBSTRING" VALUE="/view_building.asp"/>
       <OTHER NAME="QUERYSTRING_PARAMETER" TYPE="SUBSTRING" VALUE="building=8"/>
       <OTHER NAME="QUERYSTRING_PARAMETER" TYPE="SUBSTRING" VALUE="floor=10"/>     
      <RESULT ID="1" STATUS="SUCCESS" NUMINV="3"/>
      <INFO VALUE="remove-view-building8-10th-floor"/>
   </OBJECTRESULT>
</INVALIDATIONRESULT>

The following message is written to the event log:

[13/Jul/2005:19:26:46 +0000] [notification 11748] [invalidation] [ecid: 21085932
167,0] Invalidation with INFO 'remove-view-building8-10th-floor' has returned with status 'SUCCESS'; number of objects invalidated: '3'.

See Also:

"Enhance Query String Invalidations" to optimize invalidations using QUERYSTRING_PARAMETER

Example: Invalidating Objects Using Search Key Matching

The following request invalidates all objects under /pls/publicuser/, matching the following:

  • Substring /pls/publicuser/!MODULE.wwpob_page.show

  • HTTP request header x-oracle-cache-user and value PUBLICUSER

  • Surrogate-Key response-header field containing a search key of template_id=33,31345.

<?xml version="1.0"?>
<!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATION VERSION="WCS-1.1">
<OBJECT>
    <ADVANCEDSELECTOR URIPREFIX="/pls/publicuser/" HOST="www.company.com:80"
      METHOD="POST">
      <OTHER NAME="SEARCHKEY" VALUE="template_id=33,31345"/>
      <HEADER NAME="x-oracle-cache-user" VALUE="PUBLICUSER"/>
      <OTHER NAME="URI" TYPE="SUBSTRING"
        VALUE="/pls/publicuser/!MODULE.wwpob_page.show"/>
    </ADVANCEDSELECTOR>
    <ACTION REMOVALTTL="0"/>
</OBJECT>
</INVALIDATION>

Invalidation response:

<?xml version="1.0"?> 
<!DOCTYPE INVALIDATIONRESULT SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATIONRESULT VERSION="WCS-1.1">
   <OBJECTRESULT>
    <ADVANCEDSELECTOR URIPREFIX="/pls/publicuser/" HOST="www.company.com:80"
      METHOD="POST">
      <OTHER NAME="SEARCHKEY" VALUE="template_id=33,31345"/>
      <HEADER NAME="x-oracle-cache-user" VALUE="PUBLICUSER"/>
      <OTHER NAME="URI" TYPE="SUBSTRING"
        VALUE="/pls/publicuser/!MODULE.wwpob_page.show"/>
      <RESULT ID="1" STATUS="SUCCESS" NUMINV="3"/>
   </OBJECTRESULT>
</INVALIDATIONRESULT>

Example: Propagating Invalidation Requests Throughout a Cache Cluster

In a cache cluster, you can enable or disable the propagation of invalidation requests to all cluster members. You specify the setting from the Cluster Members and Properties page of Application Server Control Console (Web Cache Home page > Administration tab > Cluster Properties > Members and Properties) or the Clustering page (Properties > Clustering) of OracleAS Web Cache Manager.

You can override the setting by using a pair of name/value attributes of the SYSTEMINFO element. If NAME is set to WCS_PROPAGATE and VALUE is set to TRUE, it overrides the setting specified in OracleAS Web Cache Manager. If NAME is set to WCS_PROPAGATE and VALUE is set to FALSE, it reads the setting specified in OracleAS Web Cache Manager.

The following request invalidates the file /images/logo.gif and propagates the request to all cluster members. In this example, there are three cluster members:

<?xml version="1.0"?>
<!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATION VERSION="WCS-1.1">
   <SYSTEM>
      <SYSTEMINFO NAME="WCS_PROPAGATE" VALUE="TRUE"/>
   </SYSTEM>
   <OBJECT>
     <BASICSELECTOR URI="/hostname:port/images/logo.gif"/>
     <ACTION/>
   </OBJECT>
</INVALIDATION>

Invalidation response:

<?xml version="1.0"?> 
<!DOCTYPE INVALIDATIONRESULTDETAIL SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATIONRESULTDETAIL VERSION="WCS-1.1">
  <INVALIDATIONRESULT VERSION="WCS-1.1">
     <SYSTEM>
       <SYSTEMINFO NAME="WCS_CACHE_NAME" VALUE="Cache_A"/>
     </SYSTEM>
     <OBJECTRESULT>
       <BASICSELECTOR URI="http://www.company.com:80/images/logo.gif"/>
       <RESULT ID="1" STATUS="SUCCESS" NUMINV="1"/>
     </OBJECTRESULT>
  </INVALIDATIONRESULT>
  <INVALIDATIONRESULT VERSION="WCS-1.1">
     <SYSTEM>
       <SYSTEMINFO NAME="WCS_CACHE_NAME" VALUE="Cache_B"/>
     </SYSTEM>
     <OBJECTRESULT>
       <BASICSELECTOR URI="http://www.company.com:80/images/logo.gif"/>
       <RESULT ID="1" STATUS="SUCCESS" NUMINV="1"/>
     </OBJECTRESULT>
  </INVALIDATIONRESULT>
  <INVALIDATIONRESULT VERSION="WCS-1.1">
     <SYSTEM>
       <SYSTEMINFO NAME="WCS_CACHE_NAME" VALUE="Cache_C"/>
     </SYSTEM>
     <OBJECTRESULT>
       <BASICSELECTOR URI="http://www.company.com:80/images/logo.gif"/>
       <RESULT ID="1" STATUS="SUCCESS" NUMINV="1"/>
     </OBJECTRESULT>
  </INVALIDATIONRESULT>
</INVALIDATIONRESULTDETAIL>

Example: Previewing Invalidation

The following request previews up to 50 objects ending in *.htm:

<?xml version="1.0"?>
<!DOCTYPE INVALIDATIONPREVIEW SYSTEM
"internal:///WCSinvalidation.dtd">
<INVALIDATIONPREVIEW VERSION="WCS-1.1" STARTNUM="0" MAXNUM="50">
  <ADVANCEDSELECTOR URIPREFIX="http://company-sun/"
                    URIEXP=".*\.htm" >
  </ADVANCEDSELECTOR>
</INVALIDATIONPREVIEW>

Invalidation response:

"<?xml version="1.0"?>
<!DOCTYPE INVALIDATIONPREVIEWRESULT SYSTEM
"internal:///WCSinvalidation.dtd">
<INVALIDATIONPREVIEWRESULT VERSION="WCS-1.1" STATUS="SUCCESS"
                           STARTNUM="0" NUMURLS="2" TOTALNUMURLS="2">
  <SYSTEM>
    <SYSTEMINFO NAME="WCS_CACHE_NAME" VALUE="server-cache"/>
  </SYSTEM>
  <SELECTEDURL VALUE="/company-sun:80/index.htm "/>
  <SELECTEDURL VALUE="/company-sun:80/dtd.htm "/>
</INVALIDATIONPREVIEWRESULT>

Inline Invalidation in HTTP Responses

Inline invalidation is implemented as part of Edge Side Includes (ESI) and provides a useful way for origin servers to "piggyback" invalidation messages on transactional responses sent to Web Cache. For instance, when a customer purchases a vegetarian cookbook on an e-commerce site, the confirmation response could contain instructions for invalidating all catalog pages related to the book, its author and vegetables. The ability to send invalidation message inline reduces the connection overhead associated with sending out-of-band invalidations and is a useful tool for ESI developers.

To configure inline invalidation:

  1. In the template page, configure the HTTP response with the Surrogate-Control response-header field that includes content="ESI-INV/1.0":

    Surrogate-Control: content="ESI-INV/1.0"
    
    
  2. In the body of the same response, use the <esi:invalidate> tag to insert either a basic or advanced inline invalidation request.

    You can insert an inline invalidation request anywhere in the ESI template. You can insert more than one, but only the first one will be processed. The execution of the inline invalidation is blocking. That is, if the ESI template contains other ESI features, inline invalidation will be executed first.

    Basic invalidation syntax:

    <esi:invalidate [output="yes"]>
     <?xml version="1.0"?>
     <!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
      <INVALIDATION VERSION="WCS-1.1">
        <SYSTEM>
         <SYSTEMINFO NAME="name" VALUE="value"/>
        </SYSTEM>  
        <OBJECT>
          <BASICSELECTOR URI="URL"/>
          <ACTION REMOVALTTL="TTL"/>
          <INFO VALUE="value"/>
        </OBJECT>
     </INVALIDATION>
    </esi:invalidate>
    
    

    Advanced invalidation syntax:

    <esi:invalidate [output="yes"]>
     <?xml version="1.0"?>
     <!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
     <INVALIDATION VERSION="WCS-1.1">
        <SYSTEM>
         <SYSTEMINFO NAME="name" VALUE="value"/>
        </SYSTEM>  
           <OBJECT>
             <ADVANCEDSELECTOR URIPREFIX="prefix"
                               URIEXP="URL_expression"
                               HOST="host_name:port"
                               METHOD="HTTP_request_method"
                              BODYEXP="HTTP_body"/>
              <COOKIE NAME="cookie_name" VALUE="value"/>
              <HEADER NAME="HTTP_request_header" VALUE="value"/>
              <OTHER NAME="URI|BODY|QUERYSTRING_PARAMETER|SEARCHKEY"
                     TYPE="SUBSTRING|REGEX"
                     VALUE="value"/>
             </ADVANCEDSELECTOR>
           </OBJECT>
     </INVALIDATION>
    </esi:invalidate>
    

See Also:


Example: Using Inline Invalidation

Following is an example about an online bike shop using inline invalidation in their simple Web application. It has two CGI scripts written in Perl. show_bike.pl displays how many bikes of a certain model are in stock. Since it involves database query and its result remains the same until a purchase occurs, show_bike.pl is cached. buy_bike.pl is used by customers to buy a bike. Once this page is requested, show_bike.pl is no longer valid—an invalidation is needed.

Example 13-1 shows the code for show_bike.pl.

Example 13-1 show_bike.pl Code

#!/usr/local/bin/perl

# first, retrieve how many bikes are in stock 
# and assign it to $nBikes (omitted!)

print <<END;
Content-Type: text/html
Cache-Control: private
Surrogate-Control: max-age=3600

<html>
<body>
<h1>Bike: model 2005</h1>

<p>There are $nBikes bike(s) in stock for purchase!</p>
<p>Click <a href="/cgi/buy_bike.pl">here</a> to purchase a bike.</p>

</body>
</html>
END

Note that max-age=3600 informs OracleAS Web Cache to only cache this page for up to an hour.

Example 13-2 shows the code for buy_bike.pl with an inline invalidation request.

Example 13-2 buy_bike.pl Code with an Inline Invalidation Request

#!/usr/local/bin/perl

print <<END;
Content-Type: text/html
Cache-Control: private
Surrogate-Control: content="ESI/1.0 ESI-INV/1.0"

<html>
<body>
<h1>Thank you for purchasing bike model 2000.</h1>

<p>Click <a href="/cgi/show_bike.pl">here</a> to read more 
about this model.</p>

<esi:invalidate>
 <?xml version="1.0"?>
 <!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
  <INVALIDATION VERSION="WCS-1.1">
    <OBJECT>
      <BASICSELECTOR URI="/cgi/show_bike.pl"/>
      <ACTION REMOVALTTL="0"/>
    </OBJECT>
 </INVALIDATION>
</esi:invalidate>

<p>Thanks again!</p>
</body>
</html>
END

The ESI-INV/1.0 token in Surrogate-Control instructs OracleAS Web Cache to process the <esi:invalidate> tag.

Example 13-3 shows the browser response for buy_bike.pl. Because OracleAS Web Cache has already processed the inline invalidation request, the inline invalidation is not present in the response.

Example 13-3 Browser Response of buy_bike.pl

Content-Type: text/html
Cache-Control: private
Surrogate-Control: content="ESI/1.0 ESI-INV/1.0"

<html>
<body>
<h1>Thank you for purchasing bike model 2000.</h1>

<p>Click <a href="/cgi/show_bike.pl">here</a> to read more 
about this model.</p>

<p>Thanks again!</p>
</body>
</html>

Debugging Tips

To facilitate debugging, the application developer can perform the following:

  • Add the Surrogate-Capability request header that includes "ESI-INV/1.0":

    Surrogate-Capability: content="ESI-INV/1.0"
    
    

    When the Surrogate-Capability request header is added for inline invalidation, OracleAS Web Cache includes the invalidation request in the response.

  • Enable the output attribute of the <esi:invalidate> tag.

    When the output attribute is enabled, OracleAS Web Cache includes the invalidation result in the response enclosed within comments <!--result-->.

Example 13-4 shows the browser response of buy_bike.pl when both the Surrogate-Capability request header is enabled for the inline invalidation and the output attribute of the <esi:invalidate> tag is enabled.

Example 13-4 Browser Response of show_bike.pl with Diagnostic Inline Invalidation Information

Content-Type: text/html
Cache-Control: private
Surrogate-Control: content="ESI/1.0 ESI-INV/1.0"

<html>
<body>
<h1>Thank you for purchasing bike model 2000.</h1>

<p>Click <a href="/cgi/show_bike.pl">here</a> to read more 
about this model.</p>

<esi:invalidate output="yes">
 <?xml version="1.0"?>
 <!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
  <INVALIDATION VERSION="WCS-1.1">
    <OBJECT>
      <BASICSELECTOR URI="/cgi/show_bike.pl"/>
      <ACTION REMOVALTTL="0"/>
    </OBJECT>
 </INVALIDATION>
</esi:invalidate>

<!--
<?xml version="1.0"?> 
<!DOCTYPE INVALIDATIONRESULT SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATIONRESULT VERSION="WCS-1.1">
   <OBJECTRESULT>
     <BASICSELECTOR URI="/cgi/show_bike.pl/>
     <RESULT ID="1" STATUS="SUCCESS" NUMINV="1"/>
     </OBJECTRESULT>
</INVALIDATIONRESULT>
-->

<p>Thanks again!</p>
</body>
</html>

Reducing Invalidation Overhead

When OracleAS Web Cache receives an advanced invalidation request, it traverses the contents of the cache to locate the objects to invalidate. Depending on the structure and number of objects cached, it can take time for OracleAS Web Cache to invalidate content. Here are some ways you can expedite cache content traversal:

Send Basic Invalidation Requests for Invalidating One Object

When you need to invalidate one object in the cache, send a basic invalidation request rather than an advanced invalidation request to avoid cache traversal.

To send a basic invalidation request, use one of the following options:

  • Select option The single object that matches this URL from the Invalidation page of Application Server Control Console (Web Cache Home page > Administration tab > Operations > Invalidation).

  • Use the Basic Content Invalidation page (Operations > Basic Content Invalidation) of OracleAS Web Cache Manager.

  • Specify the BASICSELECTOR element.

For example, the following request invalidates an object exactly matching /contacts/contacts.html using the BASICSELECTOR element:

<?xml version="1.0"?>
<!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATION VERSION="WCS-1.1">
   <OBJECT>
     <BASICSELECTOR URI="http://www.company.com:80/contacts/contacts.html"/>
     <ACTION REMOVALTTL="0"/>
   </OBJECT>
</INVALIDATION>

Advanced invalidation requests should be reserved for invalidation of multiple objects. To send an advanced invalidation request, use the Advanced Content Invalidation page or specify the ADVANCEDSELECTOR element.

To send an advanced invalidation request, use one of the following options:

  • Select option Specified objects from the Invalidation page of Application Server Control Console (Web Cache Home page > Administration tab > Operations > Invalidation).

  • Use the Advanced Content Invalidation page (Operations > Advanced Content Invalidation) of OracleAS Web Cache Manager.

  • Specify the ADVANCEDSELECTOR element.

Use Substring Matching for Invalidating Multiple Objects in Advanced Invalidations

When multiple objects share a common URL, request POST body, or an embedded URL parameter, you can express the common elements in multiple ways:

  • Common URL:

    • Use the URL Expression section from the Invalidation: Select Objects page of Application Server Control Console (Web Cache Home page > Administration tab > Operations > Invalidation).

    • Use the URL Expression field from the Advanced Content Invalidation page of OracleAS Web Cache Manager (Operations > Advanced Content Invalidation).

    • Use the URIEXP attribute of the ADVANCEDSELECTOR element.

    • Use the OTHER element of the ADVANCEDSELECTOR element with a NAME attribute value of URI.

  • Common request POST body:

    • Use the HTTP Method and POST Body Expression fields from the Invalidation: Select Objects page of Application Server Control Console (Web Cache Home page > Administration tab > Operations > Invalidation).

    • Use the HTTP Method and POST Body Expression fields from the Advanced Content Invalidation page of OracleAS Web Cache Manager (Operations > Advanced Content Invalidation).

    • Use the METHOD and BODYEXP attributes of the ADVANCEDSELECTOR element.

    • Use the OTHER element of the ADVANCEDSELECTOR element with a NAME attribute value of BODY.

  • Common embedded URL parameter:

    • Use the URL Parameters section from the Invalidation: Select Objects page of Application Server Control Console (Web Cache Home page > Administration tab > Operations > Invalidation).

    • Use the URL Parameters section from the Advanced Content Invalidation page of OracleAS Web Cache Manager (Operations > Advanced Content Invalidation).

    • Use the OTHER element of the ADVANCEDSELECTOR element with a NAME attribute value of QUERYSTRING_PARAMETER.

For the quickest invalidation, Oracle recommends using the OTHER element to specify a substring for literal matching rather than regular expression for pattern matching.

To send an advanced invalidation request with substring matching, use one of the following options:

  • Use XML message syntax:

    1. Specify the OTHER element in a manual invalidation request that uses the ADVANCEDSELECTOR element.

    2. Specify the NAME attribute to use a value of URI, BODY, or QUERYSTRING_PARAMETER.

    3. Specify the TYPE attribute to use a value of SUBSTRING.

    4. Specify the VALUE attribute to use the value of URI, BODY, or QUERYSTRING_PARAMETER.

  • Use the Substring option for the URL Expression section from the Invalidation: Select Objects page of Application Server Control Console (Web Cache Home page > Administration tab > Operations > Invalidation).

  • Use the substring option for the URL Expression field from the Advanced Content Invalidation page of OracleAS Web Cache Manager (Operations > Advanced Content Invalidation).

For example, the following request searches for any objects within http://www.company.com:1100/pls/portal/!PORTAL.wwpro_app_provider.execute_portlet/595897563/ that match the following criteria:

  • The HTTP request method is an HTTP POST request method.

  • The URI contains the substring showPortlet.Show.

  • The HTTP POST body contains the substring _language=EN-US.

  • The HTTP request headers are x-oracle-cache-user and x-oracle-cache-subid with respective values of PORTAL and 1.

  • The embedded URL parameters exactly match _portlet_id and _provider_id.

<?xml version="1.0"?>
<!DOCTYPE INVALIDATION SYSTEM
"http://www.oracle.com/webcache/90400/WCSinvalidation.dtd">
<INVALIDATION VERSION="WCS-1.1">
  <OBJECT>
    <ADVANCEDSELECTOR
URIPREFIX="/pls/portal/!PORTAL.wwpro_app_provider.execute_portlet/595897563/"
HOST="wc-cluster.company.com:1100" METHOD="POST">
      <OTHER NAME="QUERYSTRING_PARAMETER" TYPE="SUBSTRING"
VALUE="_portlet_id=2"/>
      <OTHER NAME="QUERYSTRING_PARAMETER" TYPE="SUBSTRING"
VALUE="_provider_id=595897563"/>
      <HEADER NAME="x-oracle-cache-user" VALUE="PORTAL"/>
      <HEADER NAME="x-oracle-cache-subid" VALUE="1"/>
      <OTHER NAME="BODY" TYPE="SUBSTRING" VALUE="_language=EN-US"/>
      <OTHER NAME="URI" TYPE="SUBSTRING" VALUE="showPortlet.Show"/>
    </ADVANCEDSELECTOR>
    <ACTION REMOVALTTL="0"/>
    <INFO VALUE="Invalidate an old portlet based on portlet ID and
provider ID"/>
  </OBJECT>
</INVALIDATION>

Enhance Query String Invalidations

If you are using the QUERYSTRING_PARAMETER in an invalidation request, it can take additional processing time for OracleAS Web Cache to match and invalidate the objects.

To optimize the invalidation process for query string invalidations:

  1. Use a text editor to open the webcache.xml file.

  2. Locate the SECURITY and WATCHDOG elements:

    ...
      <SECURITY>
        <USER .../>
        <USER .../>
        <SECURESUBNET ...>
        </SECURESUBNET>
        <DEBUGINFO HEADER="YES" BODY="NO"/>
      </SECURITY>      
    
      <WATCHDOG ENABLE="YES"/>
    ...
    
    
  3. Between the SECURITY and WATCHDOG elements, add an INVALIDATIONINDEX element in the following format:

      <SECURITY>
      ...
      </SECURITY>
    
      <INVALIDATIONINDEX>
       <INDEXPARAM VALUE="NAME_OF_QUERYSTRING_PARAMETER"/>
       <INDEXPARAM VALUE="NAME_OF_QUERYSTRING_PARAMETER"/>
      </INVALIDATIONINDEX>
    
      <WATCHDOG ENABLE="YES|NO"/>
    
    
  4. Save webcache.xml.

  5. Restart OracleAS Web Cache with the following command:

    opmnctl restartproc ias-component=WebCache
    
    

The following example request invalidates all objects under /corporate/asp/ matching the substring /view_building.asp and the embedded URL parameter value pairs of building=8 and floor=10. In addition, the request provides the comment "remove-view-building8-10th-floor" to be included in the invalidation result and event log.

<?xml version="1.0"?>
<!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
<INVALIDATION VERSION="WCS-1.1">
  <OBJECT>
    <ADVANCEDSELECTOR URIPREFIX="/corporate/asp/"
                      HOST="www.company.com:80">
      <OTHER NAME="URI" TYPE="SUBSTRING" VALUE="/view_building.asp"/>
      <OTHER NAME="QUERYSTRING_PARAMETER" TYPE="SUBSTRING" VALUE="building=8"/>
      <OTHER NAME="QUERYSTRING_PARAMETER" TYPE="SUBSTRING" VALUE="floor=10"/>
    </ADVANCEDSELECTOR>
    <ACTION REMOVALTTL="0" />
    <INFO VALUE="remove-view-building8-10th-floor"/>
  </OBJECT>
</INVALIDATION>

To optimize this search, update webcache.xml file with the following:

...
  <SECURITY>
  ...
  </SECURITY>      

  <INVALIDATIONINDEX>
    <INDEXPARAM VALUE="building"/>
    <INDEXPARAM VALUE="floor"/>
  </INVALIDATIONINDEX>

  <WATCHDOG ENABLE="YES"/>
...

Using Search Keys in Surrogate-Key Response Header and Invalidation Requests

You can base invalidation on one or more search keys used in the Surrogate-Key response-header field of objects in the cache. This section contains the following topics:

Surrogate-Key Response-Header Field

The Surrogate-Key response-header field enables application developers to identify search key strings for a given response object. Search keys are strings that may not appear in the URL, cookies, or HTTP request headers of objects. The intent of the search keys is to provide another criteria for invalidation. In addition to the URL of objects, OracleAS Web Cache administrators can base invalidation on one or more search keys used in the Surrogate-Key response-header field of objects in the cache.

The Surrogate-Key response-header field supports the following syntax:

Surrogate-Key: search-key=("key" "key" "key" ...)

Usage Notes

  • If search-key is specified in this header, then at least one search key value must be present.

  • Search key values must be enclosed within quotes (").

  • Search key values can be of any format, such as "key_value" or "key_name=key_value".

  • The maximum number of allowed search keys is 20.

  • Multiple search key values are separated by quotes.

  • Space between search keys is optional.

  • The search keys must remain the same.

    If search keys are replaced in a response, then OracleAS Web Cache assumes the search keys are the same.

Example Usage

The following examples show valid Surrogate-Key fields. The first example shows one search key of template_id=33,31345, and the second example shows search keys of template_id=33,31345 and category.

Surrogate-Key: search-key=( "template_id=33,31345"  )

Surrogate-Key: search-key=("template_id=33,31345" "category")

The following examples show invalid Surrogate-Key fields. The first example shows one search key of 348 without an ending quote ("), and the second example shows search-key without any search key values.

Surrogate-Key: search-key=( "template_id=348 )
Surrogate-Key: search-key=( )

Enabling Search-Key Invalidation

To enable this feature:

  1. Configure the HTTP response with the Surrogate-Key response-header field as follows:

    Surrogate-Key: search-key=("key" "key" "key" ...)
    

    See Also:

    "Surrogate-Key Response-Header Field" for a complete description of the Surrogate-Key response-header field

    By default, OracleAS Web Cache supports up to 20 search keys. To increase the limit:

    1. Use a text editor to open the webcache.xml file.

    2. Locate the MAXSEARCHKEYSPERDOC attribute in the SEARCHKEYOPTIONS element:

      <GLOBALCACHINGRULES>
             <SEARCHKEYOPTIONS ENABLE="YES" MAXSEARCHKEYSPERDOC="20"/>
      
             <ERRORPAGES>
      
      
    3. Modify the value to larger value.

      The following example shows a search key limit of 35.

      <GLOBALCACHINGRULES>
            <SEARCHKEYOPTIONS ENABLE="YES" MAXSEARCHKEYSPERDOC="35"/>
      
            <ERRORPAGES>
      
      
    4. Save webcache.xml.

  2. Specify the search key in the invalidation request using one of the following methods:

    • Use the Search Keys field from the Invalidation: Select Objects page of Application Server Control Console (Web Cache Home page > Administration tab > Operations > Invalidation).

    • Use the Search Keys section from the Advanced Content Invalidation page (Operations > Advanced Content Invalidation) of OracleAS Web Cache Manager.

    • Specify the OTHER element in a manual XML invalidation request to use the ADVANCEDSELECTOR element, and specify the NAME and VALUE attributes to use SEARCHKEY and the search key value, respectively.


See Also: