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: DB_ENV->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>DB_ENV->set_cache_max</b> 14</td> 15<td align=right> 16<a href="/api_c/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 <db.h> 23<p> 24int 25DB_ENV->set_cache_max(DB_ENV *dbenv, u_int32_t gbytes, u_int32_t bytes); 26<p> 27int 28DB_ENV->get_cache_max(DB_ENV *dbenv, u_int32_t *gbytesp, u_int32_t *bytesp); 29</pre></b> 30<hr size=1 noshade> 31<b>Description: DB_ENV->set_cache_max</b> 32<p>The DB_ENV->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_c/env_set_cachesize.html">DB_ENV->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 DB_ENV->set_cache_max method configures a database environment, not only operations 45performed using the specified <a href="/api_c/env_class.html">DB_ENV</a> handle.</p> 46<p>The DB_ENV->set_cache_max method may be called at any time during the life of the 47application.</p> 48<p>The DB_ENV->set_cache_max method 49returns a non-zero error value on failure 50and 0 on success. 51</p> 52<b>Parameters</b> <br> 53 <b>mp_mmapsize</b><ul compact><li>The <b>mp_mmapsize</b> parameter is the maximum file size, in bytes, 54for a file to be mapped into the process address space.</ul> 55<br> 56<br><b>Errors</b> 57<p>The DB_ENV->set_cache_max method 58may fail and return one of the following non-zero errors:</p> 59<br> 60<b>EINVAL</b><ul compact><li>If the method was called after <a href="/api_c/env_open.html">DB_ENV->open</a> was called; or if an 61invalid flag value or parameter was specified.</ul> 62<br> 63<hr size=1 noshade> 64<b>Description: DB_ENV->get_cache_max</b> 65<p>The DB_ENV->get_cache_max method returns the maximum size of the cache.</p> 66<p>The DB_ENV->get_cache_max method may be called at any time during the life of the 67application.</p> 68<p>The DB_ENV->get_cache_max method 69returns a non-zero error value on failure 70and 0 on success. 71</p> 72<b>Parameters</b> <br> 73 <b>bytesp</b><ul compact><li>The <b>bytesp</b> parameter references memory into which 74 the additional bytes of memory in the cache is copied.</ul> 75 <b>gbytesp</b><ul compact><li>The <b>gbytesp</b> parameter references memory into which 76 the gigabytes of memory in the cache is copied.</ul> 77<br> 78<hr size=1 noshade> 79<br><b>Class</b> 80<a href="/api_c/env_class.html">DB_ENV</a> 81<br><b>See Also</b> 82<a href="/api_c/env_list.html">Database Environments and Related Methods</a> 83</tt> 84<table width="100%"><tr><td><br></td><td align=right> 85<a href="/api_c/api_core.html"><img src="/images/api.gif" alt="API"></a><a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a> 86</td></tr></table> 87<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 88</body> 89</html> 90