Flush any cached information to disk.

Namespace:  BerkeleyDB
Assembly:  libdb_dotnet52 (in libdb_dotnet52.dll) Version:


public void Sync()
Visual Basic (Declaration)
Public Sub Sync
Visual C++
void Sync()


If the database is in memory only, Sync has no effect and will always succeed.

It is important to understand that flushing cached information to disk only minimizes the window of opportunity for corrupted data. Although unlikely, it is possible for database corruption to happen if a system or application crash occurs while writing data to the database. To ensure that database corruption never occurs, applications must either: use transactions and logging with automatic recovery or edit a copy of the database, and once all applications using the database have successfully called Close()()(), atomically replace the original database with the updated copy.

See Also