[...] this means that (the pickled representation of) the objects stored in the database should be fairly small, and in rare cases key collisions may cause the database to refuse updates.
Original Berkeley DB was limited to 2GB of data. Dbm libraries also sometimes limit the total size of a key/value pair, and the total size of all the keys that hash to the same value. These limits can be as little as 512 bytes. That said, gdbm and recent versions of Berkeley DB do away with these limits.
在这里找到:
http://www.gossamer-threads.com/lists/python/python/13891
ps
在链接页面有人也在某处发现了这个,但他的链接已经死了。在
内置模块^{} 可用于此目的。例如:
如果底层数据库引擎是} 模块会讨论一些限制(例如,名为
dbm
,则^{dbm
的Python模块,它与Unixndbm
或BSD DB或ndbm
的GNU-GDBM兼容性接口接口接口接口):目前还不清楚这是只适用于
ndbm
本身,还是兼容接口;“相当小”在数量上意味着什么;以及这些情况有多“罕见”。在实际上,Ruby也有DBM的绑定,它有this to say:
我假设这没什么好担心的,因为不太可能使用
ndbm
,而且如果碰到这些限制,就会(希望)抛出一个描述性异常,此时我们需要进一步处理。在我认为没有办法自己指定底层数据库。shelve使用anydbm,而anydbm则使用whichdb模块,该模块按以下顺序尝试以下底层实现
您可以使用shelve.BsdDbShelfShelf的子类来强制使用bsd*d*b实现。在
相关问题 更多 >
编程相关推荐