REXXTAGS.org :: Cache support in REXXTAGS
Home Specs

Since version 1.1 of 2003/05/27, REXXTAGS supports optional caching. Compilation of a file can be expensive when a page includes many tags (or <%=variables%>), slowing HTTP download. The cache mechanism keeps a copy of the compiled REXX file; when the same page is requested again, REXXTAGS detects if the page needs to be compiled again (simply matter of checking some timestamps); if the page does not need recompiling, it produces a one-line REXX routine which calls the cached REXX page. This process is transparent to the user (and the webmaster).

Caching is activated on a per-directory level by using the following RexxSetVar directive:

     RexxSetVar cache_active "<cache-status>"

where "<cache-status>" can be "1" (or "yes", or "YES", etc) to activate the cache, or "0" (or "no", or "NO", etc) to keep the cache inactivated (the default).

Cache files are stored in the same directory where the RSP page resides. This means that Apache should have write access to all the directories where caching is active (if this is too much for you, e-mail me at jm@jmblasco.com, and we can discuss some alternatives). If you don't want your cache files to be directly accesible by users, you can instruct Apache not to allow access to them:

     <Files ~ "\.cache\.rex$">
     Order allow,deny
     Deny from all
     Satisfy All
     </Files>

Cache files are stored by default by appending a suffix of ".cache.rex" to the page name, so that, for example "mypage.rsp" is cached as "mypage.rsp.cache.rex", and "index.html" is cached as "index.html.cache.rex". If you prefer some other suffix, you can do so by using the following RexxSetVar directive:

     RexxSetVar cache_suffix "<suffix>"

Each cached page stores the timestamps for 1) the original page (obviously); 2) all tag procedures associated to the REXX tags used in the page, and 3) all REXX routines directly or indirectly imported into the page. If any of these files changes, the cache automatically recompiles the page when the next access occurs.

If you want to erase cache files (for example, to refresh the cache, or to install a new version or a derivative of REXXTAGS), you must do so manually from the operating system shell. For example in Windows you can open a System prompt, go the document root and type "del *.cache.rex /s" to erase all cache files.

WARNING: Use of SysFileDetele in REXXTAGS cache support: REXXTAGS cache mechanism makes use of RexxUtil's SysFileDelete function, which comes native on OS/2 operating systems. In Windows and Unix systems, you can use the similar RegUtil package developer by Patrick TJ McPhee which can be downloaded here. RexxUtil (or RegUtil) should be loaded before starting the Apache process.

Cache support sould be considered experimental in REXXTAGS. It has been tested on Apache 1.3.22 for OS/2 running on Warp Server for e-Business (see for example the following web: Grupo Cero Barcelona, and of course the REXXTAGS site itself) and seems to work flawlessly. I would be interested to hear any news about how it works on other platforms.


/specs/cache.html
Last update: 16/06/03 at 16:59
 Comments
Valid XHTML 1.0! Valid CSS!