 |
 |
 |
 |
 |
 |
 |
Request Cache (for results) |
 |
 |
 |
Request Cache (for results)
Description:
The request cache works independently of XAPool. To use it, you need to create a file with requests (SQL or not) which have to be cached. It is possible to specify a time-to-live parameter (millseconds) to force a life time of the results in the cache. By default, the time to live is 24 hours.
The syntax of this file must be the following:
[#][ttl=[a_time_to_live]
Elements between [ ] are optionals.
The # element allows to add a comment on the line, then, the result of this request will not be cached.
Example:
ttl=123456789 select [*] from test
Regular expression:
A request could be a simple request, or a pattern of requests, to unify a lot of requests in the same result, allowing to match a lot of built requests on the same pattern. These patterns works with Regular Expression (RegEx) defined bo java (java.util.regex).
Example:
application request :
Select * from employee
New syntax with regex :
Select [*] from employee
This request contains .* which allows to matchs requests which have a beginning and and end, identical to the pattern (to the left and the right of the patternt). .* replace characters.
=> We obtain a generic request.
Constraints:
You need to re-evaluate some characters:
- you must add a \ character before the following characters: { } +
ex: { will be \{
ex: + will be \+
- if you use * character, you need to add [ and ] around this character
ex: * will be [*]
Be carreful: You need to remove any blank line into the cache request file
To reset the cache:
To restart the requests cache, you need to call the reset() method:
import org.enhydra.jdbc.util.RequestCache;
RequestCache uc = RequestCache.getInstance();
uc.reset();
|
 |
 |
 |
 |
 |
 |
|
 |
 |
 |
|