Caching Functions

Often database tables will be accessed randomly using rec_fetch_main(EQUAL) or the equivalent call to rec_fetch(). If the data in a table is essentially read-only as far as a particular program is concerned and you expect records to be accessed frequently, a program can use the cache functions to reduce the number of calls made to the DBMS. This is done as follows:

Note

Records cannot be cached directly in either of these circumstances:

Replace calls to:

rec_fetch_main(EQUAL,&table.l,0) 

with:

if (!cache_find(&table.l) && rec_fetch_main(EQUAL, &table.l,0))
cache_post(&table.l);