lmdb.open的参数
readahead
`readahead`:
If ``False``, LMDB will disable the OS filesystem readahead
mechanism, which may improve random read performance when a
database is larger than RAM.
如果为False
,则LMDB将禁用OS文件系统预读机制,可以改善随机读取的性能数据库大于RAM。
create
`create`:
If ``False``, do not create the directory `path` if it is missing.
readonly
`readonly`:
If ``True``, disallow any write operations. Note the lock file is
still modified. If specified, the ``write`` flag to
:py:meth:`begin` or :py:class:`Transaction` is ignored.
如果为True
,则禁止执行任何写操作。 注意锁文件是仍然修改。
如果指定,则将write
标志:py:meth:begin
或:py:class:Transaction
被忽略。
lock
`lock`:
If ``False``, don't do any locking. If concurrent access is
anticipated, the caller must manage all concurrency itself. For
proper operation the caller must enforce single-writer semantics,
and must ensure that no readers are using old transactions while a
writer is active. The simplest approach is to use an exclusive lock
so that no readers may be active at all when a writer begins.
如果为False
,请不要进行任何锁定。 如果并发访问是预期,调用者必须自己管理所有并发。
为了调用者必须执行正确的操作,才能强制执行单写者语义, 并且必须确保没有读者使用旧交易,而是活跃的。
最简单的方法是使用排他锁这样一来,当作家开始写作时,就不会有任何读者处于活跃状态。
map_size
`map_size`:
Maximum size database may grow to; used to size the memory mapping.
If database grows larger than ``map_size``, an exception will be
raised and the user must close and reopen :py:class:`Environment`.
On 64-bit there is no penalty for making this huge (say 1TB). Must
be <2GB on 32-bit.
.. note::
**The default map size is set low to encourage a crash**, so
users can figure out a good value before learning about this
option too late.
数据库的最大大小可能会增加到; 如果数据库的大小大于map_size的大小,则会引发异常,用户必须关闭并重新打开环境。
在64位上,使它变大(例如1TB)不会受到任何惩罚。 在32位上必须小于2GB。
默认大小设置得太小会导致崩溃,因此用户在了解此选项之前为时已晚,可以找到一个好的价值。