6 Caching and Compressing Content
HTTP Methods
7 Invalidating Content
7.5 Format of Invalidation Requests for Out-of-Band and ESI Inline Mechanisms
7.5.5 Invalidation Examples
This section contains the following invalidation request examples:
■ Section 7.5.5.1, "Example: Invalidating One Object"
■ Section 7.5.5.2, "Example: Invalidating Multiple Objects"
■ Section 7.5.5.3, "Example: Invalidating a Subtree of Objects"
■ Section 7.5.5.4, "Example: Invalidating All Objects for a Web Site"
■ Section 7.5.5.5, "Example: Invalidating Objects Using Prefix Matching"
■ Section 7.5.5.6, "Example: Invalidating Objects Using Substring and Query String Matching"
■ Section 7.5.5.7, "Example: Invalidating Objects Using Search Key Matching"
Table 7–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:
■ 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
■ Section 7.5.5.8, "Example: Propagating Invalidation Requests Throughout a Cache Cluster"
■ Section 7.5.5.9, "Example: Previewing Invalidation"
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.
7.5.5.1 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/>
<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.
7.5.5.2 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 />
<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:
[15/Oct/2008: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'.
. . .
[15/Oct/2008: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'.
7.5.5.3 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>
<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>
<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>
7.5.5.4 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>
7.5.5.5 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 Oracle 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 with a URI containing /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.
7.5.5.6 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>
<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 writes to the event log:
[15/Oct/2008: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: '52'.
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"/>
<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 writes to the event log:
[15/Oct/2008: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 Section 7.7.2.2 to optimize invalidations using QUERYSTRING_PARAMETER.
7.5.5.7 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>
<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>
7.5.5.8 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 in Fusion Middleware Control and Oracle Web Cache Manager, as described in Section 3.6.5 and Section 3.7.4, respectively.
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 Fusion Middleware Control or Oracle Web Cache Manager. If NAME is set to WCS_PROPAGATE and VALUE is set to FALSE, it reads the setting specified in Fusion Middleware Control or Oracle 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="/web_cache_host_name:port/images/logo.gif"/>
<ACTION/>
<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>
7.5.5.9 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>