Library Version 12.1.6.2

DbMpoolFile::set_flags()
Prev | Chapter 9. The DbMpoolFile Handle | Next

## DbMpoolFile::set_flags()

    #include <db_cxx.h>

    int
    DbMpoolFile::set_flags(u_int32_t flags, bool onoff);

Configure a file in the cache.

To set the flags for a particular database, call the `DbMpoolFile::set_flags()` method using the DbMpoolFile handle stored in the mpf field of the Db handle.

The `DbMpoolFile::set_flags()` method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success.

### Parameters

#### flags

The flags must be set to one of the following values:

- `DB_MPOOL_NOFILE`

  If set, no backing temporary file will be opened for the specified in-memory database, even if it expands to fill the entire cache. Attempts to create new database pages after the cache has been filled will fail.

  The `DB_MPOOL_NOFILE` flag configures a file in the cache, not only operations performed using the specified DbMpoolFile handle.

  The `DB_MPOOL_NOFILE` flag may be used to configure Berkeley DB at any time during the life of the application.

- `DB_MPOOL_UNLINK`

  If set, remove the file when the last reference to it is closed.

  The `DB_MPOOL_ULINK` flag configures a file in the cache, not only operations performed using the specified DbMpoolFile handle.

  The `DB_MPOOL_ULINK` flag may be used to configure Berkeley DB at any time during the life of the application.

#### onoff

If onoff is zero, the specified flags are cleared; otherwise they are set.

### Class

DbEnv, DbMpoolFile

### See Also

Memory Pools and Related Methods

Prev | Up | Next
DbMpoolFile::set_fileid() | Home | DbMpoolFile::set_ftype()