| 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>DB_ENV->set_cache_max()</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="memp.html" title="Chapter 8. The DB_MPOOLFILE Handle" /> |
| 11 | <link rel="prev" href="memptrickle.html" title="DB_ENV->memp_trickle()" /> |
| 12 | <link rel="next" href="envset_cachesize.html" title="DB_ENV->set_cachesize()" /> |
| 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">DB_ENV->set_cache_max()</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="memptrickle.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 8. |
| 26 | The DB_MPOOLFILE Handle |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="envset_cachesize.html">Next</a></td> |
| 29 | </tr> |
| 30 | </table> |
| 31 | <hr /> |
| 32 | </div> |
| 33 | <div class="sect1" lang="en" xml:lang="en"> |
| 34 | <div class="titlepage"> |
| 35 | <div> |
| 36 | <div> |
| 37 | <h2 class="title" style="clear: both"><a id="envset_cache_max"></a>DB_ENV->set_cache_max()</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">#include <db.h> |
| 42 | |
| 43 | int |
| 44 | DB_ENV->set_cache_max(DB_ENV *dbenv, u_int32_t gbytes, u_int32_t bytes); </pre> |
| 45 | <p> |
| 46 | Sets the maximum cache size in bytes. The specified size is |
| 47 | rounded to the nearest multiple of the cache region size, which is |
| 48 | the initial cache size divided by the number of regions specified |
| 49 | to the <a class="xref" href="envset_cachesize.html" title="DB_ENV->set_cachesize()">DB_ENV->set_cachesize()</a> method. If no value is |
| 50 | specified, it defaults to the initial cache |
| 51 | size. |
| 52 | </p> |
| 53 | <p> |
| 54 | The database environment's maximum cache size may also be |
| 55 | configured using the environment's <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file. The syntax of |
| 56 | the entry in that file is a single line with the string |
| 57 | "set_cache_max", one or more whitespace characters, and the |
| 58 | maximum cache size in bytes, specified in two parts: the gigabytes |
| 59 | of cache and the additional bytes of cache. Because the |
| 60 | <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is read when the database environment is opened, |
| 61 | it will silently overrule configuration done before that time. |
| 62 | </p> |
| 63 | <p> |
| 64 | The <code class="methodname">DB_ENV->set_cache_max()</code> method configures a database environment, |
| 65 | not only operations performed using the specified |
| 66 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> handle. |
| 67 | </p> |
| 68 | <p> |
| 69 | The <code class="methodname">DB_ENV->set_cache_max()</code> method must be |
| 70 | called prior to opening the database environment. |
| 71 | </p> |
| 72 | <p> |
| 73 | The <code class="methodname">DB_ENV->set_cache_max()</code> <span> |
| 74 | <span> |
| 75 | method returns a non-zero error value on failure and 0 on success. |
| 76 | </span> |
| 77 | |
| 78 | </span> |
| 79 | </p> |
| 80 | <div class="sect2" lang="en" xml:lang="en"> |
| 81 | <div class="titlepage"> |
| 82 | <div> |
| 83 | <div> |
| 84 | <h3 class="title"><a id="idp53303464"></a>Parameters</h3> |
| 85 | </div> |
| 86 | </div> |
| 87 | </div> |
| 88 | <div class="sect3" lang="en" xml:lang="en"> |
| 89 | <div class="titlepage"> |
| 90 | <div> |
| 91 | <div> |
| 92 | <h4 class="title"><a id="idp53326480"></a>gbytes</h4> |
| 93 | </div> |
| 94 | </div> |
| 95 | </div> |
| 96 | <p> |
| 97 | The <span class="bold"><strong>gbytes</strong></span> parameter specifies the number of |
| 98 | bytes which, when added to the <span class="bold"><strong>bytes</strong></span> |
| 99 | parameter, specifies the maximum size of the cache. |
| 100 | </p> |
| 101 | </div> |
| 102 | <div class="sect3" lang="en" xml:lang="en"> |
| 103 | <div class="titlepage"> |
| 104 | <div> |
| 105 | <div> |
| 106 | <h4 class="title"><a id="idp53311824"></a>bytes</h4> |
| 107 | </div> |
| 108 | </div> |
| 109 | </div> |
| 110 | <p> |
| 111 | The <span class="bold"><strong>bytes</strong></span> parameter specifies the number of |
| 112 | bytes which, when added to the <span class="bold"><strong>gbytes</strong></span> |
| 113 | parameter, specifies the maximum size of the cache. |
| 114 | </p> |
| 115 | </div> |
| 116 | </div> |
| 117 | <div class="sect2" lang="en" xml:lang="en"> |
| 118 | <div class="titlepage"> |
| 119 | <div> |
| 120 | <div> |
| 121 | <h3 class="title"><a id="idp53323104"></a>Errors</h3> |
| 122 | </div> |
| 123 | </div> |
| 124 | </div> |
| 125 | <p> |
| 126 | The <code class="methodname">DB_ENV->set_cache_max()</code> <span> |
| 127 | <span> |
| 128 | method may fail and return one of the following non-zero errors: |
| 129 | </span> |
| 130 | |
| 131 | </span> |
| 132 | </p> |
| 133 | <div class="sect3" lang="en" xml:lang="en"> |
| 134 | <div class="titlepage"> |
| 135 | <div> |
| 136 | <div> |
| 137 | <h4 class="title"><a id="idp53298680"></a>EINVAL</h4> |
| 138 | </div> |
| 139 | </div> |
| 140 | </div> |
| 141 | <p> |
| 142 | An invalid flag value or parameter was specified. |
| 143 | </p> |
| 144 | </div> |
| 145 | </div> |
| 146 | <div class="sect2" lang="en" xml:lang="en"> |
| 147 | <div class="titlepage"> |
| 148 | <div> |
| 149 | <div> |
| 150 | <h3 class="title"><a id="idp53337136"></a>Class</h3> |
| 151 | </div> |
| 152 | </div> |
| 153 | </div> |
| 154 | <p> |
| 155 | <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a> |
| 156 | </p> |
| 157 | </div> |
| 158 | <div class="sect2" lang="en" xml:lang="en"> |
| 159 | <div class="titlepage"> |
| 160 | <div> |
| 161 | <div> |
| 162 | <h3 class="title"><a id="idp53339264"></a>See Also</h3> |
| 163 | </div> |
| 164 | </div> |
| 165 | </div> |
| 166 | <p> |
| 167 | <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> |
| 168 | </p> |
| 169 | </div> |
| 170 | </div> |
| 171 | <div class="navfooter"> |
| 172 | <hr /> |
| 173 | <table width="100%" summary="Navigation footer"> |
| 174 | <tr> |
| 175 | <td width="40%" align="left"><a accesskey="p" href="memptrickle.html">Prev</a> </td> |
| 176 | <td width="20%" align="center"> |
| 177 | <a accesskey="u" href="memp.html">Up</a> |
| 178 | </td> |
| 179 | <td width="40%" align="right"> <a accesskey="n" href="envset_cachesize.html">Next</a></td> |
| 180 | </tr> |
| 181 | <tr> |
| 182 | <td width="40%" align="left" valign="top">DB_ENV->memp_trickle() </td> |
| 183 | <td width="20%" align="center"> |
| 184 | <a accesskey="h" href="index.html">Home</a> |
| 185 | </td> |
| 186 | <td width="40%" align="right" valign="top"> DB_ENV->set_cachesize()</td> |
| 187 | </tr> |
| 188 | </table> |
| 189 | </div> |
| 190 | </body> |
| 191 | </html> |