A
gdbm
class is a wrapper around the GDBM
library.
The
GDBM
library implements a simple key/value database in a flat file.
The
gdbm
class provides the following methods:
Create a new GDBM file.
Fetch a record associated with a given key.
Store a record associated with a given key.
Delete the record associated with a given key.
Enumerate all keys stored in the GDBM file.
A
gdbm
does not open the GDBM file immediately, upon
instantiation.
The
GDBM
file gets opened automatically the first time it's accessed by any method.
Additionally, a method is provided to close the
GDBM file
(if another method is called afterwards the file gets reopened).
The
gdbm
class also creates a lock file in parallel with the
GDBM
file.
The type of the lock parallels the access method.
Instantiating a read-only
gdbm
object creates a read-only lock.
Instantiating a read-write
gdbm
object creates a read-write lock.