• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt/router/db-4.8.30/docs/programmer_reference/
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>Flushing the database cache</title>
7    <link rel="stylesheet" href="gettingStarted.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 Programmer's Reference Guide" />
10    <link rel="up" href="am.html" title="Chapter��3.�� Access Method Operations" />
11    <link rel="prev" href="am_verify.html" title="Database verification and salvage" />
12    <link rel="next" href="am_close.html" title="Database close" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">Flushing the database cache</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="am_verify.html">Prev</a>��</td>
22          <th width="60%" align="center">Chapter��3.��
23		Access Method Operations
24        </th>
25          <td width="20%" align="right">��<a accesskey="n" href="am_close.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="am_sync"></a>Flushing the database cache</h2>
35          </div>
36        </div>
37      </div>
38      <p>The <a href="../api_reference/C/dbsync.html" class="olink">DB-&gt;sync()</a> method flushes all modified records from the database
39cache to disk.</p>
40      <p>
41        <span class="bold">
42          <strong>It is important to understand that flushing cached information
43to disk only minimizes the window of opportunity for corrupted data, it
44does not eliminate the possibility.</strong>
45        </span>
46      </p>
47      <p>While unlikely, it is possible for database corruption to happen if a
48system or application crash occurs while writing data to the database. To
49ensure that database corruption never occurs, applications must either:</p>
50      <div class="itemizedlist">
51        <ul type="disc">
52          <li>Use transactions and logging with automatic recovery.</li>
53          <li>Use logging and application-specific recovery.</li>
54          <li>Edit a copy of the database, and, once all applications
55using the database have successfully called <a href="../api_reference/C/dbclose.html" class="olink">DB-&gt;close()</a>, use
56system operations (for example, the POSIX rename system call) to
57atomically replace the original database with the updated copy.</li>
58        </ul>
59      </div>
60    </div>
61    <div class="navfooter">
62      <hr />
63      <table width="100%" summary="Navigation footer">
64        <tr>
65          <td width="40%" align="left"><a accesskey="p" href="am_verify.html">Prev</a>��</td>
66          <td width="20%" align="center">
67            <a accesskey="u" href="am.html">Up</a>
68          </td>
69          <td width="40%" align="right">��<a accesskey="n" href="am_close.html">Next</a></td>
70        </tr>
71        <tr>
72          <td width="40%" align="left" valign="top">Database verification and salvage��</td>
73          <td width="20%" align="center">
74            <a accesskey="h" href="index.html">Home</a>
75          </td>
76          <td width="40%" align="right" valign="top">��Database close</td>
77        </tr>
78      </table>
79    </div>
80  </body>
81</html>
82