# mco_disk_save_cache
RT

> Save the cache to persistent media.

### Prototype

        MCO_RET	mco_disk_save_cache(	/*IN*/ mco_db_h db, /*IN*/ char const* file_path );

### Arguments

db | The database handle that was established by `mco_db_connect()`
file_path | The path to the file where the cache image will be saved

### Description

> This function saves the Disk Manager cache to persistent media.

### Return Codes

MCO_S_OK | Cache image successfully saved
MCO_E_DISK_OPEN | Error opening/creating file on persistent storage device
MCO_E_DISK_WRITE | Error writing to persistent storage device
MCO_E_DISK_CLOSE | Error closing persistent storage device

### Example

        Application snippet:

        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;
            char * file_path = "c:\temp\backup\cache.sav";

            ...
            rc = mco_db_open_dev( dbname, simple_get_dictionary(), dev, 4, &db_params );

            if ( MCO_S_OK != rc )
            {
                rc = mco_db_connect(  dbname, &db );
                ...
                rc = mco_disk_save_cache( db, file_path);

                ...
            }
        }

### Files

Header file:
mco.h
Source file:
mcodisk.c
Library:
libmcovtdsk.a
Header file:
mco.h
Source file:
mcovtmem.c
Library:
libmcovtmem.a