Infrasctucture Cache Layer Function Reference
Cache Layer
The cache layer is used to save information to disk so that it is non-volatile across process or system crashes or reboots.   nbsp; In other words, if a piece of data or a request absolutely HAS to get there, you better cache it.   nbsp; Data may be added (cached) or deleted (uncached) randomly or read sequentially as a process starts up (restore).   nbsp; Cache handles are integers in the range of 1 to 1*231, values less than 1 are used as error returns.   nbsp; Each record in the cache has an 'id' (identifier) which is used to uncache the record.   nbsp; Cached records may be variable in size.

cchCln  nbsp;  nbsp; cchOpn  nbsp;  nbsp;   nbsp;  nbsp; cchWt  nbsp;  nbsp; cchRd  nbsp;  nbsp; cchUnch  nbsp;  nbsp;

intcchCln( int cHndl )
Delete all records in cache and truncate the file. Returns zero.

int  nbsp;cchOpn( char* fileName )
Opens a cache file for reading or writing.   On success it returns an integer cache handle required by all other cache API calls.   On error it returns ERR (-1).

>intcchRd( int )
 

int  nbsp;cchWt( int cHndl )
Writes a record to the cache file represented by cHndl.   The 'data' argument is a pointer to the data to be written , 'len' is the number of bytes to write and 'id' is a 32 bit record identifyer which must be used to retrieve the record.   On success it returns the number of data bytes written.   On error it returns ERR (-1).

int  nbsp;cchRd( int cHndl )
Reads a record sequentially, from the cache file represented by cHndl.   The 'data' argument is a pointer to the data area, 'len' is a pointer to an integer to contain the number of bytes read.   On success it returns the 'id' of the record retrieved.   On error it returns ERR (-1).

int  nbsp;cchUnch( int cHndl, long id )
Remove a record from the cache file represented by cHndl.   If the record was the last in the file the file is truncated.   Returns zero.