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">
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()" />
15 <div xmlns="" class="navheader">
17 <p>Library Version 11.2.5.3</p>
19 <table width="100%" summary="Navigation header">
21 <th colspan="3" align="center">DB_ENV->set_cache_max()</th>
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
28 <td width="20%" align="right"> <a accesskey="n" href="envset_cachesize.html">Next</a></td>
33 <div class="sect1" lang="en" xml:lang="en">
34 <div class="titlepage">
37 <h2 class="title" style="clear: both"><a id="envset_cache_max"></a>DB_ENV->set_cache_max()</h2>
41 <pre class="programlisting">#include <db.h>
44 DB_ENV->set_cache_max(DB_ENV *dbenv, u_int32_t gbytes, u_int32_t bytes); </pre>
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
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.
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.
69 The <code class="methodname">DB_ENV->set_cache_max()</code> method must be
70 called prior to opening the database environment.
73 The <code class="methodname">DB_ENV->set_cache_max()</code> <span>
75 method returns a non-zero error value on failure and 0 on success.
80 <div class="sect2" lang="en" xml:lang="en">
81 <div class="titlepage">
84 <h3 class="title"><a id="idp61280496"></a>Parameters</h3>
88 <div class="sect3" lang="en" xml:lang="en">
89 <div class="titlepage">
92 <h4 class="title"><a id="idp61291016"></a>gbytes</h4>
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.
102 <div class="sect3" lang="en" xml:lang="en">
103 <div class="titlepage">
106 <h4 class="title"><a id="idp61277832"></a>bytes</h4>
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.
117 <div class="sect2" lang="en" xml:lang="en">
118 <div class="titlepage">
121 <h3 class="title"><a id="idp61281328"></a>Errors</h3>
126 The <code class="methodname">DB_ENV->set_cache_max()</code> <span>
128 method may fail and return one of the following non-zero errors:
133 <div class="sect3" lang="en" xml:lang="en">
134 <div class="titlepage">
137 <h4 class="title"><a id="idp61280280"></a>EINVAL</h4>
142 An invalid flag value or parameter was specified.
146 <div class="sect2" lang="en" xml:lang="en">
147 <div class="titlepage">
150 <h3 class="title"><a id="idp61302080"></a>Class</h3>
155 <a class="link" href="env.html" title="Chapter 5. The DB_ENV Handle">DB_ENV</a>
158 <div class="sect2" lang="en" xml:lang="en">
159 <div class="titlepage">
162 <h3 class="title"><a id="idp61304208"></a>See Also</h3>
167 <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a>
171 <div class="navfooter">
173 <table width="100%" summary="Navigation footer">
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>
179 <td width="40%" align="right"> <a accesskey="n" href="envset_cachesize.html">Next</a></td>
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>
186 <td width="40%" align="right" valign="top"> DB_ENV->set_cachesize()</td>