Once you are done using the database, you must close it. You use the method to do this.
Closing a database causes it to become unusable until it is opened again. Note that you should make sure that any open cursors are closed before closing your database. Active cursors during a database close can cause unexpected results, especially if any of those cursors are writing to the database. You should always make sure that all your database accesses have completed before closing your database.
Cursors are described in Using Cursors later in this manual.
Be aware that when you close the last open handle
for a database, then by default its cache is flushed to disk.
This means that any information that has
been modified in the cache is guaranteed to be written to disk when the
last handle is closed. You can manually perform this operation using
the
Database.sync()
method, but for normal shutdown operations it is not necessary.
For more information about syncing your cache, see
Data Persistenceic unit of storage that you use with the DPL. That is, it
is a unit of encapsulation for the classes that you want to store in DB. Under
the hood it actually interacts with DB databases, but the DPL provides a layer
of abstraction from the underlying DB APIs. The store, therefore, provides a
simplified mechanism by which you read and write your stored classes. By using a
store, you have access to your classes that is more simplified than if you were
interacting with databases directly, but this simplified access comes at the cost of
reduced flexibility.
Entity stores have configurations in the same way that environments have
configurations. You can use a StoreConfig object
to identify store properties. Among these are methods that allow you to declare
whether:
the