Library Version 11.2.5.2

Chapter 8. The DB_MPOOLFILE Handle
Prev |  | Next

## Chapter 8. The DB_MPOOLFILE Handle

    #include <db.h>

    typedef struct __db_mpoolfile DB_MPOOLFILE;

The memory pool interfaces for the Berkeley DB database environment are methods of the DB_ENV handle. The DB_ENV 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 DB_MPOOLFILE->get() are pinned in the cache until they are returned to the control of the cache using the DB_MPOOLFILE->put() method.

The `DB_MPOOLFILE` object is the handle for a file in the cache. The handle is not free-threaded. Once the DB_MPOOLFILE->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
--- | ---
DB->get_mpf() | Return the DB_MPOOLFILE for a DB
DB_ENV->memp_stat() | Return cache statistics
DB_ENV->memp_stat_print() | Print cache statistics
DB_ENV->memp_sync() | Flush all pages from the cache
DB_ENV->memp_trickle() | Flush some pages from the cache
Memory Pool Configuration
DB_ENV->memp_register() | Register a custom file type
DB_ENV->set_cache_max(), DB_ENV->get_cache_max() | Set/get the maximum cache size
DB_ENV->set_cachesize(), DB_ENV->get_cachesize() | Set/get the environment cache size
DB_ENV->set_mp_max_openfd(), DB_ENV->get_mp_max_openfd() | Set/get the maximum number of open file descriptors
DB_ENV->set_mp_max_write(), DB_ENV->get_mp_max_write() | Set/get the maximum number of sequential disk writes
DB_ENV->set_mp_mmapsize(), DB_ENV->get_mp_mmapsize() | Set/get maximum file size to memory map when opened read-only
DB_ENV->set_mp_mtxcount(), DB_ENV->get_mp_mtxcount() | Set/get the number of mutexes allocated to the hash table
DB_ENV->set_mp_pagesize(), DB_ENV->get_mp_pagesize() | Set/get page size to configure the buffer pool
DB_ENV->set_mp_tablesize(), DB_ENV->get_mp_tablesize() | Set/get the hash table size
Memory Pool Files
DB_ENV->memp_fcreate() | Create a memory pool file handle
DB_MPOOLFILE->close() | Close a file in the cache
DB_MPOOLFILE->get() | Get page from a file in the cache
DB_MPOOLFILE->open() | Open a file in the cache
DB_MPOOLFILE->put() | Return a page to the cache
DB_MPOOLFILE->sync() | Flush pages from a file from the cache
Memory Pool File Configuration
DB_MPOOLFILE->set_clear_len(), DB_MPOOLFILE->get_clear_len() | Set/get number of bytes to clear when creating a new page
DB_MPOOLFILE->set_fileid(), DB_MPOOLFILE->get_fileid() | Set/get file unique identifier
DB_MPOOLFILE->set_flags(), DB_MPOOLFILE->get_flags() | Set/get file options
DB_MPOOLFILE->set_ftype(), DB_MPOOLFILE->get_ftype() | Set/get file type
DB_MPOOLFILE->set_lsn_offset(), DB_MPOOLFILE->get_lsn_offset() | Set/get file log-sequence-number offset
DB_MPOOLFILE->set_maxsize(), DB_MPOOLFILE->get_maxsize() | Set/get maximum file size
DB_MPOOLFILE->set_pgcookie(), DB_MPOOLFILE->get_pgcookie() | Set/get file cookie for pgin/pgout
DB_MPOOLFILE->set_priority(), DB_MPOOLFILE->get_priority() | Set/get cache file priority

Prev |  | Next
log_compare | Home | DB->get_mpf()