| 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 xmlns="" class="navheader"> |
| 16 | <div class="libver"> |
| 17 | <p>Library Version 11.2.5.3</p> |
| 18 | </div> |
| 19 | <table width="100%" summary="Navigation header"> |
| 20 | <tr> |
| 21 | <th colspan="3" align="center">Chapter 8. |
| 22 | The DB_MPOOLFILE Handle |
| 23 | </th> |
| 24 | </tr> |
| 25 | <tr> |
| 26 | <td width="20%" align="left"><a accesskey="p" href="logcompare.html">Prev</a> </td> |
| 27 | <th width="60%" align="center"> </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="dbget_mpf.html">Next</a></td> |
| 29 | </tr> |
| 30 | </table> |
| 31 | <hr /> |
| 32 | </div> |
| 33 | <div class="chapter" lang="en" xml:lang="en"> |
| 34 | <div class="titlepage"> |
| 35 | <div> |
| 36 | <div> |
| 37 | <h2 class="title"><a id="memp"></a>Chapter 8. |
| 38 | The DB_MPOOLFILE Handle |
| 39 | </h2> |
| 40 | </div> |
| 41 | </div> |
| 42 | </div> |
| 43 | <pre class="programlisting">#include <db.h> |
| 44 | |
| 45 | typedef struct __db_mpoolfile DB_MPOOLFILE; </pre> |
| 46 | <p> |
| 47 | The memory pool interfaces for the Berkeley DB database environment are methods of the |
| 48 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handle. The |
| 49 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> memory pool methods and the |
| 50 | <code class="classname">DB_MPOOLFILE</code> class provide general-purpose, page-oriented buffer |
| 51 | management of files. Although designed to work with the other |
| 52 | <a class="link" href="db.html" title="Chapter 2. The DB Handle">DB</a>classes, they are also useful for more general |
| 53 | purposes. The memory pools are referred to in this document as simply |
| 54 | <span class="emphasis"><em>the cache</em></span>. |
| 55 | </p> |
| 56 | <p> |
| 57 | The cache may be shared between processes. The cache is usually filled by pages from one or |
| 58 | more files. Pages in the cache are replaced in LRU (least-recently-used) order, with each |
| 59 | new page replacing the page that has been unused the longest. Pages retrieved from the |
| 60 | cache using <a class="xref" href="mempfget.html" title="DB_MPOOLFILE->get()">DB_MPOOLFILE->get()</a> are |
| 61 | <span class="emphasis"><em>pinned</em></span> in the cache until they are returned to the control of the |
| 62 | cache using the <a class="xref" href="mempput.html" title="DB_MPOOLFILE->put()">DB_MPOOLFILE->put()</a> method. |
| 63 | </p> |
| 64 | <p> |
| 65 | The <code class="classname">DB_MPOOLFILE</code> object is the handle for a file in the |
| 66 | cache. The handle is not free-threaded. Once the |
| 67 | <a class="xref" href="mempfclose.html" title="DB_MPOOLFILE->close()">DB_MPOOLFILE->close()</a> method is called, the handle |
| 68 | may not be accessed again, regardless of that method's return. |
| 69 | </p> |
| 70 | <div class="sect1" lang="en" xml:lang="en"> |
| 71 | <div class="titlepage"> |
| 72 | <div> |
| 73 | <div> |
| 74 | <h2 class="title" style="clear: both"><a id="memplist"></a>Memory Pools and Related Methods</h2> |
| 75 | </div> |
| 76 | </div> |
| 77 | </div> |
| 78 | <div class="navtable"> |
| 79 | <table border="1" width="80%"> |
| 80 | <thead> |
| 81 | <tr> |
| 82 | <th>Memory Pools and Related Methods</th> |
| 83 | <th>Description</th> |
| 84 | </tr> |
| 85 | </thead> |
| 86 | <tbody> |
| 87 | <tr> |
| 88 | <td> |
| 89 | <a class="xref" href="dbget_mpf.html" title="DB->get_mpf()">DB->get_mpf()</a> |
| 90 | </td> |
| 91 | <td>Return the DB_MPOOLFILE for a DB</td> |
| 92 | </tr> |
| 93 | <tr> |
| 94 | <td> |
| 95 | <a class="xref" href="mempstat.html" title="DB_ENV->memp_stat()">DB_ENV->memp_stat()</a> |
| 96 | </td> |
| 97 | <td>Return cache statistics</td> |
| 98 | </tr> |
| 99 | <tr> |
| 100 | <td> |
| 101 | <a class="xref" href="mempstat_print.html" title="DB_ENV->memp_stat_print()">DB_ENV->memp_stat_print()</a> |
| 102 | </td> |
| 103 | <td>Print cache statistics</td> |
| 104 | </tr> |
| 105 | <tr> |
| 106 | <td> |
| 107 | <a class="xref" href="mempsync.html" title="DB_ENV->memp_sync()">DB_ENV->memp_sync()</a> |
| 108 | </td> |
| 109 | <td>Flush all pages from the cache</td> |
| 110 | </tr> |
| 111 | <tr> |
| 112 | <td> |
| 113 | <a class="xref" href="memptrickle.html" title="DB_ENV->memp_trickle()">DB_ENV->memp_trickle()</a> |
| 114 | </td> |
| 115 | <td>Flush some pages from the cache</td> |
| 116 | </tr> |
| 117 | <tr> |
| 118 | <td colspan="2"> |
| 119 | <span class="bold"> |
| 120 | <strong>Memory Pool Configuration</strong> |
| 121 | </span> |
| 122 | </td> |
| 123 | </tr> |
| 124 | <tr> |
| 125 | <td> |
| 126 | <a class="xref" href="mempregister.html" title="DB_ENV->memp_register()">DB_ENV->memp_register()</a> |
| 127 | </td> |
| 128 | <td>Register a custom file type</td> |
| 129 | </tr> |
| 130 | <tr> |
| 131 | <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> |
| 132 | <td>Set/get the maximum cache size</td> |
| 133 | </tr> |
| 134 | <tr> |
| 135 | <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> |
| 136 | <td>Set/get the environment cache size</td> |
| 137 | </tr> |
| 138 | <tr> |
| 139 | <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> |
| 140 | <td>Set/get the maximum number of open file descriptors</td> |
| 141 | </tr> |
| 142 | <tr> |
| 143 | <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> |
| 144 | <td>Set/get the maximum number of sequential disk writes</td> |
| 145 | </tr> |
| 146 | <tr> |
| 147 | <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> |
| 148 | <td>Set/get maximum file size to memory map when opened read-only</td> |
| 149 | </tr> |
| 150 | <tr> |
| 151 | <td><a class="xref" href="envset_mp_mtxcount.html" title="DB_ENV->set_mp_mtxcount()">DB_ENV->set_mp_mtxcount()</a>, <a class="xref" href="envget_mp_mtxcount.html" title="DB_ENV->get_mp_mtxcount()">DB_ENV->get_mp_mtxcount()</a></td> |
| 152 | <td>Set/get the number of mutexes allocated to the hash table</td> |
| 153 | </tr> |
| 154 | <tr> |
| 155 | <td><a class="xref" href="envset_mp_pagesize.html" title="DB_ENV->set_mp_pagesize()">DB_ENV->set_mp_pagesize()</a>, <a class="xref" href="envget_mp_pagesize.html" title="DB_ENV->get_mp_pagesize()">DB_ENV->get_mp_pagesize()</a></td> |
| 156 | <td>Set/get page size to configure the buffer pool</td> |
| 157 | </tr> |
| 158 | <tr> |
| 159 | <td><a class="xref" href="envset_mp_tablesize.html" title="DB_ENV->set_mp_tablesize()">DB_ENV->set_mp_tablesize()</a>, <a class="xref" href="envget_mp_tablesize.html" title="DB_ENV->get_mp_tablesize()">DB_ENV->get_mp_tablesize()</a></td> |
| 160 | <td>Set/get the hash table size</td> |
| 161 | </tr> |
| 162 | <tr> |
| 163 | <td colspan="2"> |
| 164 | <span class="bold"> |
| 165 | <strong>Memory Pool Files</strong> |
| 166 | </span> |
| 167 | </td> |
| 168 | </tr> |
| 169 | <tr> |
| 170 | <td> |
| 171 | <a class="xref" href="mempfcreate.html" title="DB_ENV->memp_fcreate()">DB_ENV->memp_fcreate()</a> |
| 172 | </td> |
| 173 | <td>Create a memory pool file handle</td> |
| 174 | </tr> |
| 175 | <tr> |
| 176 | <td> |
| 177 | <a class="xref" href="mempfclose.html" title="DB_MPOOLFILE->close()">DB_MPOOLFILE->close()</a> |
| 178 | </td> |
| 179 | <td>Close a file in the cache</td> |
| 180 | </tr> |
| 181 | <tr> |
| 182 | <td> |
| 183 | <a class="xref" href="mempfget.html" title="DB_MPOOLFILE->get()">DB_MPOOLFILE->get()</a> |
| 184 | </td> |
| 185 | <td>Get page from a file in the cache</td> |
| 186 | </tr> |
| 187 | <tr> |
| 188 | <td> |
| 189 | <a class="xref" href="mempfopen.html" title="DB_MPOOLFILE->open()">DB_MPOOLFILE->open()</a> |
| 190 | </td> |
| 191 | <td>Open a file in the cache</td> |
| 192 | </tr> |
| 193 | <tr> |
| 194 | <td> |
| 195 | <a class="xref" href="mempput.html" title="DB_MPOOLFILE->put()">DB_MPOOLFILE->put()</a> |
| 196 | </td> |
| 197 | <td>Return a page to the cache</td> |
| 198 | </tr> |
| 199 | <tr> |
| 200 | <td> |
| 201 | <a class="xref" href="mempfsync.html" title="DB_MPOOLFILE->sync()">DB_MPOOLFILE->sync()</a> |
| 202 | </td> |
| 203 | <td>Flush pages from a file from the cache</td> |
| 204 | </tr> |
| 205 | <tr> |
| 206 | <td colspan="2"> |
| 207 | <span class="bold"> |
| 208 | <strong>Memory Pool File Configuration</strong> |
| 209 | </span> |
| 210 | </td> |
| 211 | </tr> |
| 212 | <tr> |
| 213 | <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> |
| 214 | <td>Set/get number of bytes to clear when creating a new page</td> |
| 215 | </tr> |
| 216 | <tr> |
| 217 | <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> |
| 218 | <td>Set/get file unique identifier</td> |
| 219 | </tr> |
| 220 | <tr> |
| 221 | <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> |
| 222 | <td>Set/get file options</td> |
| 223 | </tr> |
| 224 | <tr> |
| 225 | <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> |
| 226 | <td>Set/get file type</td> |
| 227 | </tr> |
| 228 | <tr> |
| 229 | <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> |
| 230 | <td>Set/get file log-sequence-number offset</td> |
| 231 | </tr> |
| 232 | <tr> |
| 233 | <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> |
| 234 | <td>Set/get maximum file size</td> |
| 235 | </tr> |
| 236 | <tr> |
| 237 | <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> |
| 238 | <td>Set/get file cookie for pgin/pgout</td> |
| 239 | </tr> |
| 240 | <tr> |
| 241 | <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> |
| 242 | <td>Set/get cache file priority</td> |
| 243 | </tr> |
| 244 | </tbody> |
| 245 | </table> |
| 246 | </div> |
| 247 | </div> |
| 248 | </div> |
| 249 | <div class="navfooter"> |
| 250 | <hr /> |
| 251 | <table width="100%" summary="Navigation footer"> |
| 252 | <tr> |
| 253 | <td width="40%" align="left"><a accesskey="p" href="logcompare.html">Prev</a> </td> |
| 254 | <td width="20%" align="center"> </td> |
| 255 | <td width="40%" align="right"> <a accesskey="n" href="dbget_mpf.html">Next</a></td> |
| 256 | </tr> |
| 257 | <tr> |
| 258 | <td width="40%" align="left" valign="top">log_compare </td> |
| 259 | <td width="20%" align="center"> |
| 260 | <a accesskey="h" href="index.html">Home</a> |
| 261 | </td> |
| 262 | <td width="40%" align="right" valign="top"> DB->get_mpf()</td> |
| 263 | </tr> |
| 264 | </table> |
| 265 | </div> |
| 266 | </body> |
| 267 | </html> |