Chapter 9. The DbMpoolFile Handle
Prev |  | Next

## Chapter 9. The DbMpoolFile Handle

    #include <db_cxx.h>

    class DbMpoolFile {
    public:
            DB_MPOOLFILE *DbMpoolFile::get_DB_MPOOLFILE();
            const DB_MPOOLFILE *DbMpoolFile::get_const_DB_MPOOLFILE() const; ...
    };

The memory pool interfaces for the Berkeley DB database environment are methods of the DbEnv handle. The DbEnv memory pool methods and the `DB_MPOOLFILE` class provide general-purpose, page-oriented buffer management of files. Although designed to work with the other Dbclasses, they are also useful for more general purposes. The memory pools are referred to in this document as simply the cache.

The cache may be shared between processes. The cache is usually filled by pages from one or more files. Pages in the cache are replaced in LRU (least-recently-used) order, with each new page replacing the page that has been unused the longest. Pages retrieved from the cache using DbMpoolFile::get() are pinned in the cache until they are returned to the control of the cache using the DbMpoolFile::put() method.

The `DbMpoolFile` object is the handle for a file in the cache. The handle is not free-threaded. Once the DbMpoolFile::close() method is called, the handle may not be accessed again, regardless of that method's return.

## Memory Pools and Related Methods

Memory Pools and Related Methods | Description
--- | ---
DbMemoryException | Exception class for insufficient memory
Db::get_mpf() | Return the DbMpoolFile for a Db
DbEnv::memp_stat() | Return cache statistics
DbEnv::memp_stat_print() | Print cache statistics
DbEnv::memp_sync() | Flush all pages from the cache
DbEnv::memp_trickle() | Flush some pages from the cache
Memory Pool Configuration
DbEnv::memp_register() | Register a custom file type
DbEnv::set_cache_max(), DbEnv::get_cache_max() | Set/get the maximum cache size
DbEnv::set_cachesize(), DbEnv::get_cachesize() | Set/get the environment cache size
DbEnv::set_mp_max_openfd(), DbEnv::get_mp_max_openfd() | Set/get the maximum number of open file descriptors
DbEnv::set_mp_max_write(), DbEnv::get_mp_max_write() | Set/get the maximum number of sequential disk writes
DbEnv::set_mp_mmapsize(), DbEnv::get_mp_mmapsize() | Set/get maximum file size to memory map when opened read-only
Memory Pool Files
DbEnv::memp_fcreate() | Create a memory pool file handle
DbMpoolFile::close() | Close a file in the cache
DbMpoolFile::get() | Get page from a file in the cache
DbMpoolFile::open() | Open a file in the cache
DbMpoolFile::put() | Return a page to the cache
DbMpoolFile::sync() | Flush pages from a file from the cache
Memory Pool File Configuration
DbMpoolFile::set_clear_len(), DbMpoolFile::get_clear_len() | Set/get number of bytes to clear when creating a new page
DbMpoolFile::set_fileid(), DbMpoolFile::get_fileid() | Set/get file unique identifier
DbMpoolFile::set_flags(), DbMpoolFile::get_flags() | Set/get file options
DbMpoolFile::set_ftype(), DbMpoolFile::get_ftype() | Set/get file type
DbMpoolFile::set_lsn_offset(), DbMpoolFile::get_lsn_offset() | Set/get file log-sequence-number offset
DbMpoolFile::set_maxsize(), DbMpoolFile::get_maxsize() | Set/get maximum file size
DbMpoolFile::set_pgcookie(), DbMpoolFile::get_pgcookie() | Set/get file cookie for pgin/pgout
DbMpoolFile::set_priority(), DbMpoolFile::get_priority() | Set/get cache file priority

Prev |  | Next
DbEnv::log_compare() | Home | Db::get_mpf()