WebCacheReSize Function

Action

Resizes the cache by deleting cache entries, beginning by the oldest entries, to the specified size. It will only drop elements that have been stored (or last accessed) at or before the specified date/time. Omit the second parameter to force the achievement of the specified size (regardless of the age of the cache entries).

Include file

WebApi.bdh

Syntax

WebCacheReSize( in nSize     : number,
                in nEdgeTime : number optional );

Return value

  • true if successful

  • false otherwise

Parameter Description
nSize Size which should be reached by deleting the oldest cache entries (if they are old enough - see nEdgeTime param).
nEdgeTime Specifies the edge time of cache entries to delete (optional). If entries are younger then the specified time, they must not be deleted! A negative value specifies the actual time minus the specified seconds (-4 means actual time minus 4 seconds). A positive value specifies an exact date/time in the format seconds elapsed since midnight (00:00:00), January 1, 1970 as GMT (use number(GetTimeStamp(TIMESTAMP_GMT | TIMESTAMP_IN_SEC)) to get the actual time).Omit this parameter to disable the age calculation.

Example

dcltrans
  transaction TWeb
  begin
    WebPageUrl("http://lab3/stadyn_file5k.html");
    writeln(WebCacheGetSize());
    Wait 3.0;
    WebPageUrl("http://lab3/stadyn_file5k.html?x=1");
    writeln(WebCacheGetSize());
    Wait 3.0;
    WebPageUrl("http://lab3/stadyn_file5k.html?x=2");
    writeln(WebCacheGetSize());
    Wait 3.0;
    WebPageUrl("http://lab3/stadyn_file5k.html?x=3");
    writeln(WebCacheGetSize());
    Wait 3.0;
    WebPageUrl("http://lab3/stadyn_file5k.html?x=4");
    writeln(WebCacheGetSize());
    Wait 3.0;

    WebCacheReSize(0, -31);
    writeln(WebCacheGetSize());

  end TWeb;

Output

5120
10240
15360
20480
25600
25600