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.    In other words, if a piece of data or a request absolutely HAS to get there, you better cache it.    Data may be added (cached) or deleted (uncached) randomly or read sequentially as a process starts up (restore).    Cache handles are integers in the range of 1 to 1*231, values less than 1 are used as error returns.    Each record in the cache has an 'id' (identifier) which is used to uncache the record.    Cached records may be variable in size.

cchCln     cchOpn          cchWt     cchRd     cchUnch    

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

int  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).

int   ( int )
  

int  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  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  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.