• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src/router/db-4.8.30/docs/api_reference/CXX/
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>DbEnv::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 9.  The DbMpoolFile Handle" />
11    <link rel="prev" href="memptrickle.html" title="DbEnv::memp_trickle()" />
12    <link rel="next" href="envset_cachesize.html" title="DbEnv::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">DbEnv::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 9. 
23              The  DbMpoolFile 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>DbEnv::set_cache_max()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db_cxx.h&gt;
39
40int
41DbEnv::set_cache_max(u_int32_t gbytes, u_int32_t bytes); </pre>
42      <p>
43         The <code class="methodname">DbEnv::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="DbEnv::set_cachesize()">DbEnv::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">DbEnv::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 DbEnv Handle">DbEnv</a>  handle.
64    </p>
65      <p>
66         The <code class="methodname">DbEnv::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">DbEnv::set_cache_max()</code> <span>
71            
72            <span>
73                method either returns a non-zero error value or throws an
74                exception that encapsulates a non-zero error value on
75                failure, and returns 0 on success.
76            </span>
77        </span>
78    </p>
79      <div class="sect2" lang="en" xml:lang="en">
80        <div class="titlepage">
81          <div>
82            <div>
83              <h3 class="title"><a id="id1692382"></a>Parameters</h3>
84            </div>
85          </div>
86        </div>
87        <div class="sect3" lang="en" xml:lang="en">
88          <div class="titlepage">
89            <div>
90              <div>
91                <h4 class="title"><a id="id1692544"></a>bytes</h4>
92              </div>
93            </div>
94          </div>
95          <p>
96                         The  <span class="bold"><strong>bytes</strong></span> parameter specifies the number of
97                         bytes which, when added to the <span class="bold"><strong>gbytes</strong></span>
98                         parameter,  specifies the maximum size of the cache.
99                     </p>
100        </div>
101        <div class="sect3" lang="en" xml:lang="en">
102          <div class="titlepage">
103            <div>
104              <div>
105                <h4 class="title"><a id="id1692631"></a>gbytes</h4>
106              </div>
107            </div>
108          </div>
109          <p>
110                         The  <span class="bold"><strong>gbytes</strong></span> parameter specifies the number of
111                         bytes which, when added to the <span class="bold"><strong>bytes</strong></span>
112                         parameter,  specifies the maximum size of the cache.
113                     </p>
114        </div>
115      </div>
116      <div class="sect2" lang="en" xml:lang="en">
117        <div class="titlepage">
118          <div>
119            <div>
120              <h3 class="title"><a id="id1692689"></a>Errors</h3>
121            </div>
122          </div>
123        </div>
124        <p>
125                         The <code class="methodname">DbEnv::set_cache_max()</code> <span>
126            
127            <span>
128                method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 
129                exception, encapsulating one of the following non-zero errors, or return one
130                of the following non-zero errors:
131            </span>
132        </span>
133                    </p>
134        <div class="sect3" lang="en" xml:lang="en">
135          <div class="titlepage">
136            <div>
137              <div>
138                <h4 class="title"><a id="id1692691"></a>EINVAL</h4>
139              </div>
140            </div>
141          </div>
142          <p>
143                An invalid flag value or parameter was specified.
144            </p>
145        </div>
146      </div>
147      <div class="sect2" lang="en" xml:lang="en">
148        <div class="titlepage">
149          <div>
150            <div>
151              <h3 class="title"><a id="id1692603"></a>Class</h3>
152            </div>
153          </div>
154        </div>
155        <p>
156                <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>  
157            </p>
158      </div>
159      <div class="sect2" lang="en" xml:lang="en">
160        <div class="titlepage">
161          <div>
162            <div>
163              <h3 class="title"><a id="id1692576"></a>See Also</h3>
164            </div>
165          </div>
166        </div>
167        <p>
168                     <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> 
169                </p>
170      </div>
171    </div>
172    <div class="navfooter">
173      <hr />
174      <table width="100%" summary="Navigation footer">
175        <tr>
176          <td width="40%" align="left"><a accesskey="p" href="memptrickle.html">Prev</a> </td>
177          <td width="20%" align="center">
178            <a accesskey="u" href="memp.html">Up</a>
179          </td>
180          <td width="40%" align="right"> <a accesskey="n" href="envset_cachesize.html">Next</a></td>
181        </tr>
182        <tr>
183          <td width="40%" align="left" valign="top">DbEnv::memp_trickle() </td>
184          <td width="20%" align="center">
185            <a accesskey="h" href="index.html">Home</a>
186          </td>
187          <td width="40%" align="right" valign="top"> DbEnv::set_cachesize()</td>
188        </tr>
189      </table>
190    </div>
191  </body>
192</html>
193