<!DOCTYPE File PUBLIC "-//Liam Quin//DTD C API Documentation v1.1//EN" "doc.dtd"><File>
<Entry dir="liblqtext">
<Function File="../../src/liblqtext/pbcache.c">
<Name>LQT_BlockIsCached</Name>
<Class>Database/Files, Database/Physical
<Purpose>
<P>Determine whether the block at a given offset in the data file is
in the block buffer cache or not.
Since LQT_ReadBlock returns a pointer into the cache, it is a
fatal error (E_BUG) if LQT_WriteBlock is called for a block that
is not cached.</P>
<P>The cache is always large enough to hold at least the last two
blocks returned by LQT_ReadBlock.
This is just enough to ensure that the NextOffset field in a
block's header can be filled in after allocating the next block
in a chain.</P>
<Returns>
Non-zero if the block is cached, and zero otherwise.
<Errors>
Fatal error if the main data file can't be opened or created.
<Notes>
As a side-effect, the CurrentBlock variable in pbcache.c is set to
point to the cached block; this is used internally by the library
routines in that file.
<SeeAlso>
LQT_ReadBlock
LQT_WriteBlock
</Function>
<Decl>
API int
LQT_BlockIsCached(db, Block)
    t_LQTEXT_Database *db;
    unsigned long Block;
</Decl>
</Entry>
