|

2. Where
to Start
This section tells
you about the Cache interface and how it can be implemented
to create your own cache.
2.1 Implementing the Cache
interface
The Cache interface
is the interface used by Report Server to manage Reports Cache.
You can find the Cache Java API documentation here.
1. start(java.util.Properties
cacheSystemProps, oracle.reports.utility.Trace trace)
This method Starts
the Oracle9i Reports caching service. You can use this method
to set all static information that you can load from the Reports
Server configuration file. (server.conf file in the $ORACLE_HOME/reports/config
directory). This
method receives the properties object as a parameter, which
contains the list of values in the configuration file. See the
"Integration with Oracle9i
Reports" Section.
In the Size Cache
example, the start method is used to load the following information:
- maximum size of
the cache
- maximum number
of files in the cache
- cache directory
If the cache directory
does not exist, it creates the directory.
2.
newItem(Job job, String instanceKey)
This method creates
a new item in cache system for the given job. The parameter
job is the object that will own this cache item. The other parameter
instanceKey is needed if the job will generate multiple instances
of ouput for bursting reports. This parameter indicates which
instance of the multiple outputs is being created. If it is
null, it either means the item will be for the whole job, or
that this job has only one set of output.
3.
findItem(java.util.Properties jobProps)
This method gets
the job properties like REPORT, DESTYPE, DESFORMAT, USERID,
etc from the input parameter "props". These parameters
are matched with the parameters used to submit earlier job requests
whose results are stored in the cache directory. If the current
parameters list matches with an earlier job request, the report
output is picked up from cache instead of running the request
again.
Note: If this is
a single job run from the command line, the key will be used
for comparison. If this is a distribution job, the group key
will be used for comparison. If there is a match, the first
item of the group is returned.
4.
manage()
This method manages
the cache, for example, how to keep the cache size within the
limit specified in the server.conf file. In the default cache
used with Oracle9i Reports, if the cache directory size exceeds
the limit, this method deletes items based on the "first-in
first-out" logic. In addition, it also checks for expired
items and deletes them from cache.
In the Size Cache
example, this method deletes top 5 items from the cache directory
based on the "biggest file size" logic.
5.
deleteItem(CacheItem item)
This method deletes
the cache item referred to by the parameter item. This method
can be invoked by other methods like manage and empty, for example,
whenever items have to be deleted from the cache.
6.
empty()
It invokes the method
deleteItem repetitively to delete all items in the cache.
7.
stop()
This method stops
the Oracle9i Reports caching service. You can include some logic
with this method to liberate resources like a connection pool
to a database or an LDAP server.
8.
getMaxCapacity(), setMaxCapacity()
As is clear from
their names, these methods get and set the Maximum capacity
of the cache - these values are loaded from the server.conf
file in the method start().
9.
getCurrentCapacity()
This method gets
the current capacity of the cache.
10.
getMaxNumberOfFiles(), setMaxNumberOfFiles()
As is clear from
their names, these methods get and set the Maximum number of
files allowed in the cache - these values are loaded from the
server.conf file in the method start().
11.
getCurrentNumberOfFiles()
This method gets
the current number of files in the cache.

|