version 6.5
WEB CACHE STATISTICS (pages; hits; usage)
Parameter | Type | Description | |
pages | Text Array | Names of the most consulted pages | |
hits | Longint Array | Number of hits for each page | |
usage | Number | Percentage of the cache used |
Description
The WEB CACHE STATISTICS command allows you to obtain information about the most consulted pages loaded in the Web server's cache. Consequently, these statistics only concern static pages, GIF pictures, JPEG pictures <100 KB and style sheets (.css).
Note: For more information about setting the 4D Web server's cache, please refer to section Web Server Settings.
The command fills the pages Text array with the names of the most consulted pages. The hits Longint array receives the number of "hits" for each page. The usage parameter receives the percentage of the Web cache used by each page.
Example
Let's assume that you want to generate a semi-dynamic page that displays the statistics of the Web cache. For this, in a static HTML page named "stats.shtm", you place the tag <!--4DACTION/STATS>. Then you insert two 4D variables, vPages and vUsage.
In the project method STATS, you write the following code:
C_TEXT ($1) ARRAY TEXT (pages;0) ARRAY LONGINT (hits;0) C_LONGINT (vUsage) WEB CACHE STATISTICS(pages;hits;vUsage) vPages:=Char(1) For ($i;1;Size of array(pages)) ` For each page present in the cache vPages:=vPages+pages{$i}+" "+String(hits{$i})+"<br>" ` Insert the name of the page and the HTML code End for SEND HTML FILE("stats.shtm") ` The contents of the pages with the suffix ".shtm" is always parsed
See Also
Information about the Web Site, Web Server Settings.