Oracle® Application Server Web Cache Administrator's Guide
10g Release 2 (10.1.2) B14046-04 |
|
Previous |
Next |
This chapter explains how to send invalidation requests to OracleAS Web Cache.
This chapter contains these topics:
This section provides the following topics for understanding how to send invalidation requests from external sources:
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:
|
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 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
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
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
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:
|
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:
|
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:
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:
Connect to OracleAS Web Cache at the invalidation listening port:
telnet web_cache_host invalidation_port
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:
|
Enter one carriage return.
Send the invalidation request with XML syntax.
Invalidation request syntax is described in the following sections:
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 |
---|---|
Required attribute in the Denote the version of the For versions 9.0. |
|
Optional element in the |
|
Required element in the The possible
|
|
Required element in the invalidation request. You can specify more than one |
|
|
|
The prefix is interpreted literally, including reserved regular expression characters. These characters include periods ( |
|
|
Regular expression characters are permitted. To interpret these characters literally, escape them with a backslash ( Notes:
|
|
|
|
|
|
Note: When the invalidation request is sent, OracleAS Web Cache performs a regular expression match of |
|
Optional element in the invalidation request. Use the following attributes:
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:
|
|
Optional element in the invalidation request. Use the following attributes:
See Also: "Task 1: Create Caching Rules" to create caching rules for multiple-version objects |
|
Optional element in the invalidation request. Use the following attributes:
See Also:
|
Required element in the invalidation request Optional attribute of the |
|
Optional element in the invalidation request Required attribute of the [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'. |
See Also: "Invalidation Request and Response DTD" for further information about invalidation request 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
See Also: "Invalidation Request and Response DTD" for further information about invalidation response 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 |
---|---|
Required attribute in the invalidation preview Use |
|
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. |
|
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 |
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 number of the |
|
Status of the preview. Status can be one of the following:
|
|
Number representing the first object to be listed |
|
Number of URLs returned in this preview result |
|
Number of URLs matching the |
|
URLs matching the |
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 thecache or admin server processes.
If you change the property of an invalidation port, restart the See Chapter 7 for restart instructions. |
To send a basic invalidation request using OracleAS Web Cache Manager:
In the navigator frame, select Operations > Basic Content Invalidation.
The Basic Content Invalidation page appears in the right pane.
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.)
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 ('
).
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:
In the Action section, choose Preview list of objects that match invalidation criteria.
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.
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.
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.
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:
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:
|
To send an advanced invalidation request using OracleAS Web Cache Manager:
In the navigator frame, select Operations > Advanced Content Invalidation.
The Advanced Content Invalidation page appears in the right pane.
From the For Cache list, select a cache. (More than one cache is listed only if you configured a cache cluster.)
In the Search Criteria section, select the search criteria:
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.
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:
From the list, select Cookie or Header.
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.
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.
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.
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:
In the Action section, choose Preview list of objects to be removed.
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.
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.
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.
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. |
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:
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.sh
for a shell script that invalidates objects with a telnet
session
These files are located in the $ORACLE_HOME/webcache/examples
directory on UNIX and ORACLE_HOME
\webcache\examples
directory on Windows.
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.
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.
This section contains the following invalidation request examples:
Example: Invalidating Objects Using Substring and Query String Matching
Example: Propagating Invalidation Requests Throughout a Cache Cluster
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.
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.
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'.
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>
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>
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="c
stage\?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.
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'.
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>
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>
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 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:
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"
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:
|
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>
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
Use Substring Matching for Invalidating Multiple Objects in Advanced Invalidations
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.
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:
Specify the OTHER
element in a manual invalidation request that uses the ADVANCEDSELECTOR
element.
Specify the NAME
attribute to use a value of URI
, BODY
, or QUERYSTRING_PARAMETER
.
Specify the TYPE
attribute to use a value of SUBSTRING
.
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>
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:
Use a text editor to open the webcache.xml
file.
Locate the SECURITY
and WATCHDOG
elements:
... <SECURITY> <USER .../> <USER .../> <SECURESUBNET ...> </SECURESUBNET> <DEBUGINFO HEADER="YES" BODY="NO"/> </SECURITY> <WATCHDOG ENABLE="YES"/> ...
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"/>
Save webcache.xml
.
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"/> ...
See Also:
|
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:
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.
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=( )
To enable this feature:
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:
Use a text editor to open the webcache.xml
file.
Locate the MAXSEARCHKEYSPERDOC
attribute in the SEARCHKEYOPTIONS
element:
<GLOBALCACHINGRULES> <SEARCHKEYOPTIONS ENABLE="YES" MAXSEARCHKEYSPERDOC="20"/> <ERRORPAGES>
Modify the value to larger value.
The following example shows a search key limit of 35.
<GLOBALCACHINGRULES> <SEARCHKEYOPTIONS ENABLE="YES" MAXSEARCHKEYSPERDOC="35"/> <ERRORPAGES>
Save webcache.xml
.
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:
|