previous next top contents index framed top this page unframed
| Temporary feature: subject to change |
Figure 47–19. $setFileCacheParms
| BOOLEAN PROCEDURE $setFileCacheParms (POINTER(file) f; OPTIONAL LONG BITS attributes; OPTIONAL BITS ctrlBits; OPTIONAL BOOLEAN setDefaultParms; OPTIONAL BOOLEAN setParms; OPTIONAL LONG INTEGER requestedMinSize; OPTIONAL LONG INTEGER requestedMaxSize; OPTIONAL INTEGER requestedHitPercent); |
$setFileCacheParms sets the parameters for the cache associated with the file f. If the input parameters are invalid or if f cannot be cached, an error occurs and $setFileCacheParms returns FALSE.
If f is NULLPOINTER, the global cache parameters are set and $setFileCacheParms returns TRUE.
If f is not NULLPOINTER, $setFileCacheParms examines the attributes parameter and f's current attributes to determine which cache parameters to set. The following are the possible combinations of these variables and the actions taken by $setFileCacheParms:
| f's Current Attributes | attributes Parameter | Action(s) Taken |
|---|---|---|
| global | global or Zero | The global cache parameters are set and the global cache LRU list is adjusted so that it does not exceed requestedMaxSize. |
| global | private | All of f's cached buffers are written if dirty and are removed from the global cache. All buffers except f's current buffer are disposed. f is privately cached with the specified cache parameters. |
| private | private or Zero | f's private cache parameters are set and the private cache LRU list is adjusted so that it does not exceed requestedMaxSize. |
| private | global | All of f's cached buffers are written if dirty and the private cache is disposed (including all of f's cached buffers except the current buffer). f is globally cached. The global cache parameters are set and the global cache LRU list is adjusted so that it does not exceed requestedMaxSize. |
| not cached | N/A | If the attributes parameter is not Zero, then f is cached according to the specified value. If the attributes parameter is Zero, then f is globally cached if its buffer size is the same as the size of buffers in the global cache; otherwise, f is privately cached. The appropriate cache parameters are set. If f is globally cached, then the global cache LRU list is adjusted so that it does not exceed requestedMaxSize. |
attributes specifies how the file is to be cached, i.e., $globallyCached or $privatelyCached. If not specified, the way the file is cached remains unchanged.
If setDefaultParms is TRUE, the file cache parameters are to be set to their default values. If setParms is TRUE, the file cache parameters are set to the values specified by requestedMinSize, requestedMaxSize, and requestedHitPercent. If neither setDefaultParms nor setParms is TRUE, the file cache parameters remain unchanged.
requestedMinSize and requestedMaxSize are the requested minimum and maximum number of buffers in the LRU list, respectively. requestedMinSize and requestedMaxSize must be nonnegative INTEGERs and requestedMinSize must be less than or equal to requestedMaxSize. requestedHitPercent must be an INTEGER between 0 and 100.
$setFileCacheParms returns TRUE if it successfully set the file cache parameters.
The only valid ctrlBits is errorOK. An error message is generated if an error occurs and errorOK is not specified.
The description of GCCHP in Chapter 14 of the MAINSAIL Utilities User's Guide tells more about how the file cache works.
MAINSAIL Language Manual, Section 47.17