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