1<!--$Id: env_set_cache_max.so,v 1.2 2007/07/07 14:40:15 bostic Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB: DbEnv::set_cache_max</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<table width="100%"><tr valign=top>
12<td>
13<b>DbEnv::set_cache_max</b>
14</td>
15<td align=right>
16<a href="/api_cxx/api_core.html"><img src="/images/api.gif" alt="API"></a>
17<a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a></td>
18</tr></table>
19<hr size=1 noshade>
20<tt>
21<b><pre>
22#include &lt;db_cxx.h&gt;
23<p>
24int
25DbEnv::set_cache_max(u_int32_t gbytes, u_int32_t bytes);
26<p>
27int
28DbEnv::get_cache_max(u_int32_t *gbytesp, u_int32_t *bytesp);
29</pre></b>
30<hr size=1 noshade>
31<b>Description: DbEnv::set_cache_max</b>
32<p>The DbEnv::set_cache_max method sets the maximum cache size, in bytes.
33The specified size is rounded to the nearest multiple of the cache
34region size, which is the initial cache size divided by the number of
35regions specified to the <a href="/api_cxx/env_set_cachesize.html">DbEnv::set_cachesize</a> method.  If no value is
36specified, it defaults to the initial cache size.</p>
37<p>The database environment's maximum cache size may also be configured using the
38environment's <a href="/ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file.  The syntax of the entry in that
39file is a single line with the string "set_cache_max", one or more whitespace
40characters, and the size in bytes.
41Because the <a href="/ref/env/db_config.html#DB_CONFIG">DB_CONFIG</a> file is read when the database environment
42is opened, it will silently overrule configuration done before that
43time.</p>
44<p>The DbEnv::set_cache_max method configures a database environment, not only operations
45performed using the specified <a href="/api_cxx/env_class.html">DbEnv</a> handle.</p>
46<p>The DbEnv::set_cache_max method may be called at any time during the life of the
47application.</p>
48<p>The DbEnv::set_cache_max method
49either returns a non-zero error value
50or throws an exception that encapsulates a non-zero error value on
51failure, and returns 0 on success.
52</p>
53<b>Parameters</b> <br>
54 <b>mp_mmapsize</b><ul compact><li>The <b>mp_mmapsize</b> parameter is the maximum file size, in bytes,
55for a file to be mapped into the process address space.</ul>
56<br>
57<br><b>Errors</b>
58<p>The DbEnv::set_cache_max method
59may fail and throw
60<a href="/api_cxx/except_class.html">DbException</a>,
61encapsulating one of the following non-zero errors, or return one of
62the following non-zero errors:</p>
63<br>
64<b>EINVAL</b><ul compact><li>If the method was called after <a href="/api_cxx/env_open.html">DbEnv::open</a> was called; or if an
65invalid flag value or parameter was specified.</ul>
66<br>
67<hr size=1 noshade>
68<b>Description: DbEnv::get_cache_max</b>
69<p>The DbEnv::get_cache_max method returns the maximum size of the cache.</p>
70<p>The DbEnv::get_cache_max method may be called at any time during the life of the
71application.</p>
72<p>The DbEnv::get_cache_max method
73either returns a non-zero error value
74or throws an exception that encapsulates a non-zero error value on
75failure, and returns 0 on success.
76</p>
77<b>Parameters</b> <br>
78 <b>bytesp</b><ul compact><li>The <b>bytesp</b> parameter references memory into which
79 the additional bytes of memory in the cache is copied.</ul> 
80 <b>gbytesp</b><ul compact><li>The <b>gbytesp</b> parameter references memory into which
81 the gigabytes of memory in the cache is copied.</ul> 
82<br>
83<hr size=1 noshade>
84<br><b>Class</b>
85<a href="/api_cxx/env_class.html">DbEnv</a>
86<br><b>See Also</b>
87<a href="/api_cxx/env_list.html">Database Environments and Related Methods</a>
88</tt>
89<table width="100%"><tr><td><br></td><td align=right>
90<a href="/api_cxx/api_core.html"><img src="/images/api.gif" alt="API"></a><a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a>
91</td></tr></table>
92<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
93</body>
94</html>
95