The Oracle Web Cache is a powerful tool and one that I see few
organizations taking advantage of it ability to cache dynamic documents.
A dynamic document or object is one created from data and is valid
only as long as the data does not change.
It's the "does not change" part that makes caching dynamic objects
difficult. It of course takes planning in both your
application development and database model.
While you still have to determine when an object is no longer valid,
Oracle provides some simple tools to perform the actual cache
invalidation.
The Web cache listens on an invalidation port (mine installed on
4002) for a simple HTTP POST message. The message can come from a
terminal, the application, or the database.
In PL/SQL the WXVUTIL package contains the procedures to send an
invalidation message to the web cache.
First, the package must be loaded in the database. It is
provides in the webcache/toolkit directory.
<appsvr Oracle_Home>/webcache/toolkit/wxvutil.sql.
[oracle@appsvr toolkit]$ pwd
/opt/oracle/portal904/webcache/toolkit
[oracle@appsvr toolkit]$ ls -l
-rw-r--r-- 1 oracle oinstall 672 Jul 11 2003 invalidation.dtd
-rw-r--r-- 1 oracle oinstall 65389 Nov 12 2003 jawc.jar
-rw-r--r-- 1 oracle oinstall 70 Jul 11 2003 README.toolkit.txt
-rw-r--r-- 1 oracle oinstall 4348 Jul 11 2003 WCSinvalidation.dtd
-rw-r--r-- 1 oracle oinstall 6083 Jul 11 2003 wxvappl.sql
-rw-r--r-- 1 oracle oinstall 10757 Jul 11 2003 wxvutil.sql
Notice this is the application server (or web cache if on a separate server)
ORACLE_HOME, not the database ORACLE HOME.
After the scripts are run you can create triggers on the
underlying tables of the dynamic objects. When the
database executes a DML operation on the table (INSERT, UPDATE
or DELETE), the trigger invalidates the cached objects based on
the table data.
CREATE OR REPLACE TRIGGER PRODUCT_INVALID_TRIG
AFTER DELETE OR INSERT OR UPDATE on PRODUCT FOR EACH ROW
wxvutil.invalidate_reset;
wxvutil.invalidate_uri('/MainApp/prod_list.jsp', 0,
null);
wxvutil.invalidate_exec('web.appsvr.com', 4002,
'oracie123');
You can invalidate a single object (as in the example above)
or multiple objects.
wxvutil.invalidate_uri('/MainApp/prod_list.*', 0, null);
|
|
|
|
Guarantee your Success!
Oracle is the
world's most complex, robust and flexible database, considered
impossible to master without a mentor.
That's why all BC
Oracle trainers are working professionals, experts in Oracle who
share their tips and secrets. |
|