Enable or disable the connection cache.
mco_bool mco_disk_enable_connection_cache(/*IN*/ mco_db_h db, /*IN*/ mco_bool enable);
db — The database handle that was established by mco_db_connect().enable — A mco_bool value MCO_YES to enable, MCO_NO to disable.The runtime “pins” a predefined number of pages from the page pool for each connection. This is referred to as a “connection cache”. When a transaction loads pages into the page pool, and the total number of pages loaded from the media is less than the size of the connection cache, the runtime makes sure that these pages stay in the cache until the transaction is committed, or the database connection is broken. By default the size of the connection cache is set to four pages. It is not possible to modify the connection cache size (nor does it make sense to).
The connection cache is enabled by default. This API enables or disables the connection cache and returns the current state of the connection cache.
mco_bool — The value MCO_YES if enabled, MCO_NO if disabled.
const char * dbname = "SimpleDb";
int main(int argc, char* argv[])
{
mco_db_h db;
MCO_RET rc;
mco_device_t dev[4];
mco_db_params_t db_params;
mco_bool enabled = MCO_NO;
...
rc = mco_db_open_dev( dbname, simple_get_dictionary(), dev, 4, &db_params );
if ( MCO_S_OK != rc )
{
rc = mco_db_connect( dbname, &db );
...
enabled = mco_disk_enable_connection_cache( db, enabled );
...
}
}