1<?xml version="1.0" encoding="UTF-8" standalone="no"?> 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 3<html xmlns="http://www.w3.org/1999/xhtml"> 4 <head> 5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 6 <title>Chapter 8. The DB_MPOOLFILE Handle</title> 7 <link rel="stylesheet" href="apiReference.css" type="text/css" /> 8 <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> 9 <link rel="start" href="index.html" title="Berkeley DB C API Reference" /> 10 <link rel="up" href="index.html" title="Berkeley DB C API Reference" /> 11 <link rel="prev" href="logcompare.html" title="log_compare" /> 12 <link rel="next" href="dbget_mpf.html" title="DB->get_mpf()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">Chapter 8. 19 The DB_MPOOLFILE Handle 20 </th> 21 </tr> 22 <tr> 23 <td width="20%" align="left"><a accesskey="p" href="logcompare.html">Prev</a> </td> 24 <th width="60%" align="center"> </th> 25 <td width="20%" align="right"> <a accesskey="n" href="dbget_mpf.html">Next</a></td> 26 </tr> 27 </table> 28 <hr /> 29 </div> 30 <div class="chapter" lang="en" xml:lang="en"> 31 <div class="titlepage"> 32 <div> 33 <div> 34 <h2 class="title"><a id="memp"></a>Chapter 8. 35 The DB_MPOOLFILE Handle 36 </h2> 37 </div> 38 </div> 39 </div> 40 <pre class="programlisting">#include <db.h> 41 42typedef struct __db_mpoolfile DB_MPOOLFILE; </pre> 43 <p> 44 The memory pool interfaces for the Berkeley DB database environment are methods of the 45 <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handle. The 46 <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> memory pool methods and the 47 <code class="classname">DB_MPOOLFILE</code> class provide general-purpose, page-oriented buffer 48 management of files. Although designed to work with the other 49 <a class="link" href="db.html" title="Chapter 2. The DB Handle">DB</a>classes, they are also useful for more general 50 purposes. The memory pools are referred to in this document as simply 51 <span class="emphasis"><em>the cache</em></span>. 52 </p> 53 <p> 54 The cache may be shared between processes. The cache is usually filled by pages from one or 55 more files. Pages in the cache are replaced in LRU (least-recently-used) order, with each 56 new page replacing the page that has been unused the longest. Pages retrieved from the 57 cache using <a class="xref" href="mempfget.html" title="DB_MPOOLFILE->get()">DB_MPOOLFILE->get()</a> are 58 <span class="emphasis"><em>pinned</em></span> in the cache until they are returned to the control of the 59 cache using the <a class="xref" href="mempput.html" title="DB_MPOOLFILE->put()">DB_MPOOLFILE->put()</a> method. 60 </p> 61 <p> 62 The <code class="classname">DB_MPOOLFILE</code> object is the handle for a file in the 63 cache. The handle is not free-threaded. Once the 64 <a class="xref" href="mempfclose.html" title="DB_MPOOLFILE->close()">DB_MPOOLFILE->close()</a> method is called, the handle 65 may not be accessed again, regardless of that method's return. 66 </p> 67 <div class="sect1" lang="en" xml:lang="en"> 68 <div class="titlepage"> 69 <div> 70 <div> 71 <h2 class="title" style="clear: both"><a id="memplist"></a>Memory Pools and Related Methods</h2> 72 </div> 73 </div> 74 </div> 75 <div class="navtable"> 76 <table border="1" width="80%"> 77 <thead> 78 <tr> 79 <th>Memory Pools and Related Methods</th> 80 <th>Description</th> 81 </tr> 82 </thead> 83 <tbody> 84 <tr> 85 <td> 86 <a class="xref" href="dbget_mpf.html" title="DB->get_mpf()">DB->get_mpf()</a> 87 </td> 88 <td>Return the DB_MPOOLFILE for a DB</td> 89 </tr> 90 <tr> 91 <td> 92 <a class="xref" href="mempstat.html" title="DB_ENV->memp_stat()">DB_ENV->memp_stat()</a> 93 </td> 94 <td>Return cache statistics</td> 95 </tr> 96 <tr> 97 <td> 98 <a class="xref" href="mempstat_print.html" title="DB_ENV->memp_stat_print()">DB_ENV->memp_stat_print()</a> 99 </td> 100 <td>Print cache statistics</td> 101 </tr> 102 <tr> 103 <td> 104 <a class="xref" href="mempsync.html" title="DB_ENV->memp_sync()">DB_ENV->memp_sync()</a> 105 </td> 106 <td>Flush all pages from the cache</td> 107 </tr> 108 <tr> 109 <td> 110 <a class="xref" href="memptrickle.html" title="DB_ENV->memp_trickle()">DB_ENV->memp_trickle()</a> 111 </td> 112 <td>Flush some pages from the cache</td> 113 </tr> 114 <tr> 115 <td colspan="2"> 116 <span class="bold"> 117 <strong>Memory Pool Configuration</strong> 118 </span> 119 </td> 120 </tr> 121 <tr> 122 <td> 123 <a class="xref" href="mempregister.html" title="DB_ENV->memp_register()">DB_ENV->memp_register()</a> 124 </td> 125 <td>Register a custom file type</td> 126 </tr> 127 <tr> 128 <td><a class="xref" href="envset_cache_max.html" title="DB_ENV->set_cache_max()">DB_ENV->set_cache_max()</a>, <a class="xref" href="envget_cache_max.html" title="DB_ENV->get_cache_max()">DB_ENV->get_cache_max()</a></td> 129 <td>Set/get the maximum cache size</td> 130 </tr> 131 <tr> 132 <td><a class="xref" href="envset_cachesize.html" title="DB_ENV->set_cachesize()">DB_ENV->set_cachesize()</a>, <a class="xref" href="envget_cachesize.html" title="DB_ENV->get_cachesize()">DB_ENV->get_cachesize()</a></td> 133 <td>Set/get the environment cache size</td> 134 </tr> 135 <tr> 136 <td><a class="xref" href="mempset_mp_max_openfd.html" title="DB_ENV->set_mp_max_openfd()">DB_ENV->set_mp_max_openfd()</a>, <a class="xref" href="mempget_mp_max_openfd.html" title="DB_ENV->get_mp_max_openfd()">DB_ENV->get_mp_max_openfd()</a></td> 137 <td>Set/get the maximum number of open file descriptors</td> 138 </tr> 139 <tr> 140 <td><a class="xref" href="mempset_mp_max_write.html" title="DB_ENV->set_mp_max_write()">DB_ENV->set_mp_max_write()</a>, <a class="xref" href="mempget_mp_max_write.html" title="DB_ENV->get_mp_max_write()">DB_ENV->get_mp_max_write()</a></td> 141 <td>Set/get the maximum number of sequential disk writes</td> 142 </tr> 143 <tr> 144 <td><a class="xref" href="envset_mp_mmapsize.html" title="DB_ENV->set_mp_mmapsize()">DB_ENV->set_mp_mmapsize()</a>, <a class="xref" href="envget_mp_mmapsize.html" title="DB_ENV->get_mp_mmapsize()">DB_ENV->get_mp_mmapsize()</a></td> 145 <td>Set/get maximum file size to memory map when opened read-only</td> 146 </tr> 147 <tr> 148 <td colspan="2"> 149 <span class="bold"> 150 <strong>Memory Pool Files</strong> 151 </span> 152 </td> 153 </tr> 154 <tr> 155 <td> 156 <a class="xref" href="mempfcreate.html" title="DB_ENV->memp_fcreate()">DB_ENV->memp_fcreate()</a> 157 </td> 158 <td>Create a memory pool file handle</td> 159 </tr> 160 <tr> 161 <td> 162 <a class="xref" href="mempfclose.html" title="DB_MPOOLFILE->close()">DB_MPOOLFILE->close()</a> 163 </td> 164 <td>Close a file in the cache</td> 165 </tr> 166 <tr> 167 <td> 168 <a class="xref" href="mempfget.html" title="DB_MPOOLFILE->get()">DB_MPOOLFILE->get()</a> 169 </td> 170 <td>Get page from a file in the cache</td> 171 </tr> 172 <tr> 173 <td> 174 <a class="xref" href="mempfopen.html" title="DB_MPOOLFILE->open()">DB_MPOOLFILE->open()</a> 175 </td> 176 <td>Open a file in the cache</td> 177 </tr> 178 <tr> 179 <td> 180 <a class="xref" href="mempput.html" title="DB_MPOOLFILE->put()">DB_MPOOLFILE->put()</a> 181 </td> 182 <td>Return a page to the cache</td> 183 </tr> 184 <tr> 185 <td> 186 <a class="xref" href="mempfsync.html" title="DB_MPOOLFILE->sync()">DB_MPOOLFILE->sync()</a> 187 </td> 188 <td>Flush pages from a file from the cache</td> 189 </tr> 190 <tr> 191 <td colspan="2"> 192 <span class="bold"> 193 <strong>Memory Pool File Configuration</strong> 194 </span> 195 </td> 196 </tr> 197 <tr> 198 <td><a class="xref" href="mempset_clear_len.html" title="DB_MPOOLFILE->set_clear_len()">DB_MPOOLFILE->set_clear_len()</a>, <a class="xref" href="mempget_clear_len.html" title="DB_MPOOLFILE->get_clear_len()">DB_MPOOLFILE->get_clear_len()</a></td> 199 <td>Set/get number of bytes to clear when creating a new page</td> 200 </tr> 201 <tr> 202 <td><a class="xref" href="mempset_fileid.html" title="DB_MPOOLFILE->set_fileid()">DB_MPOOLFILE->set_fileid()</a>, <a class="xref" href="mempget_fileid.html" title="DB_MPOOLFILE->get_fileid()">DB_MPOOLFILE->get_fileid()</a></td> 203 <td>Set/get file unique identifier</td> 204 </tr> 205 <tr> 206 <td><a class="xref" href="mempset_flags.html" title="DB_MPOOLFILE->set_flags()">DB_MPOOLFILE->set_flags()</a>, <a class="xref" href="mempget_flags.html" title="DB_MPOOLFILE->get_flags()">DB_MPOOLFILE->get_flags()</a></td> 207 <td>Set/get file options</td> 208 </tr> 209 <tr> 210 <td><a class="xref" href="mempset_ftype.html" title="DB_MPOOLFILE->set_ftype()">DB_MPOOLFILE->set_ftype()</a>, <a class="xref" href="mempget_ftype.html" title="DB_MPOOLFILE->get_ftype()">DB_MPOOLFILE->get_ftype()</a></td> 211 <td>Set/get file type</td> 212 </tr> 213 <tr> 214 <td><a class="xref" href="mempset_lsn_offset.html" title="DB_MPOOLFILE->set_lsn_offset()">DB_MPOOLFILE->set_lsn_offset()</a>, <a class="xref" href="mempget_lsn_offset.html" title="DB_MPOOLFILE->get_lsn_offset()">DB_MPOOLFILE->get_lsn_offset()</a></td> 215 <td>Set/get file log-sequence-number offset</td> 216 </tr> 217 <tr> 218 <td><a class="xref" href="mempset_maxsize.html" title="DB_MPOOLFILE->set_maxsize()">DB_MPOOLFILE->set_maxsize()</a>, <a class="xref" href="mempget_maxsize.html" title="DB_MPOOLFILE->get_maxsize()">DB_MPOOLFILE->get_maxsize()</a></td> 219 <td>Set/get maximum file size</td> 220 </tr> 221 <tr> 222 <td><a class="xref" href="mempset_pgcookie.html" title="DB_MPOOLFILE->set_pgcookie()">DB_MPOOLFILE->set_pgcookie()</a>, <a class="xref" href="mempget_pgcookie.html" title="DB_MPOOLFILE->get_pgcookie()">DB_MPOOLFILE->get_pgcookie()</a></td> 223 <td>Set/get file cookie for pgin/pgout</td> 224 </tr> 225 <tr> 226 <td><a class="xref" href="mempset_priority.html" title="DB_MPOOLFILE->set_priority()">DB_MPOOLFILE->set_priority()</a>, <a class="xref" href="mempget_priority.html" title="DB_MPOOLFILE->get_priority()">DB_MPOOLFILE->get_priority()</a></td> 227 <td>Set/get cache file priority</td> 228 </tr> 229 </tbody> 230 </table> 231 </div> 232 </div> 233 </div> 234 <div class="navfooter"> 235 <hr /> 236 <table width="100%" summary="Navigation footer"> 237 <tr> 238 <td width="40%" align="left"><a accesskey="p" href="logcompare.html">Prev</a> </td> 239 <td width="20%" align="center"> </td> 240 <td width="40%" align="right"> <a accesskey="n" href="dbget_mpf.html">Next</a></td> 241 </tr> 242 <tr> 243 <td width="40%" align="left" valign="top">log_compare </td> 244 <td width="20%" align="center"> 245 <a accesskey="h" href="index.html">Home</a> 246 </td> 247 <td width="40%" align="right" valign="top"> DB->get_mpf()</td> 248 </tr> 249 </table> 250 </div> 251 </body> 252</html> 253