You can specify either a URI or classname in the
<name> </name> field of the cache policy.
If you specify the URI, dynamic cache uses that cache policy for a given
request only if the request URI (servletpath + pathinfo) matches the one
specified in the <name> </name> field.
For example following request will be cached if name field looks like
<name>/Snoop/test</name>
http://localhost:9080/Snoop/test
On the other hand, if you specify the class name in the
<name> </name> field, dynamic cache is
going use that cache policy for every request that maps to that servlet
class irrespective of the servletpath and pathinfo. So if you change cache
policy to one shown below, all the following URLs will be cached.
http://localhost:9080/Snoop/test http://localhost:9080/Snoop/
http://localhost:9080/Snoop/aaa?test=1
http://localhost:9080/Snoop/aaa/test
<cache-entry>
<class>servlet</class>
<name>Snoop.class</name>
<cache-id>
<component id="test" type="parameter">
<required>false</required>
</component>
<component id="*" type="pathinfo">
<required>false</required>
</component>
<component id="*" type="servletpath">
<required>false</required>
</component>
<timeout>3600</timeout>
</cache-id>
</cache-entry>
WebSphere Application Server V5.1.1.2 added support to servlets for
multiple <cache-entry>...</cache-entry> tags.
Earlier there was support for only one cache policy per servlet.
For example for following two cache policies:
<cache-entry>
<class>servlet</class>
<name>/Snoop</name>
<cache-id>
<component id="test" type="parameter">
<required>false</required>
</component>
<component id="*" type="pathinfo">
<required>false</required>
</component>
<component id="*" type="servletpath">
<required>false</required>
</component>
<timeout>3600</timeout>
</cache-id>
</cache-entry>
<cache-entry>
<class>servlet</class>
<name>/Snoop/test</name>
<cache-id>
<component id="test" type="parameter">
<required>false</required>
</component>
<component id="*" type="pathinfo">
<required>false</required>
</component>
<component id="*" type="servletpath">
<required>false</required>
</component>
<timeout>3600</timeout>
</cache-id>
</cache-entry>
The following URLs will be cached:http://localhost:9080/Snoop/test?aaa=1
http://localhost:9080/Snoop/test http://localhost:9080/Snoop
http://localhost:9080/Snoop?test=1
The following URL will NOT be cached:
http://localhost:9080/Snoop/test/aaa
http://localhost:9080/Snoop/test/aaa?test=1
|