- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个 python BSDDB 数据库。显然,它存储在硬盘上。当我删除一些条目时,驱动器上的文件不会变小(因此 - 它增长得相当快......)
utDelList = []
urlsDelList = []
for ut in iter(self.urls2task):
tmp = string.split(ut, ":")
uid = tmp[1]
url = cPickle.loads(self.urls[int(uid)])
urlsDelList.append(uid)
utDelList.append(ut)
del self.urlsDepth[uid]
del self.urlsStatus[uid]
del url
for ut in utDelList:
del self.urls2task[ut]
for uid in urlsDelList:
del self.urls[int(uid)]
(...)
#synchronize all files
self.sync()
我最后的希望是以一种野蛮的方式强制刷新 - 通过再次关闭和打开文件
#close all files & start them again, eg
self.tasks.close()
self.urls2task.close()
self.tasks = bsddb.rnopen(filepath)
self.urls2task = bsddb.hashopen
这里的关键元素是 self.tasks 条目;它是所有文件中增长最快、最大的。酸洗保存是否会改变去除它的方式?而且,再一次 - 为什么文件在删除条目后仍然保留条目?如果有任何建议,我将不胜感激(这里是第一篇文章:))
最佳答案
您是否尝试使用 db.compact()方法?
根据文档:
compact(start=None, stop=None, flags=0, compact_fillpercent=0, compact_pages=0, compact_timeout=0)
Compacts Btree and Recno access method databases, and optionally returns unused Btree, Hash or Recno database pages to the underlying filesystem.
The method returns the number of pages returned to the filesystem.
听起来应该减少磁盘上数据库的大小
关于python bsddb 删除条目时不会刷新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7255873/
我有一个 python BSDDB 数据库。显然,它存储在硬盘上。当我删除一些条目时,驱动器上的文件不会变小(因此 - 它增长得相当快......) utDelList = [] urlsDelL
bsddb 模块有三种打开 db 文件的方法: bsddb.hashopen(filename[, flag[, mode[, pgsize[, ffactor[, nelem[, cachesize
我计划在用 python 为 windows 和 linux 编写的商业产品中使用 bsddb/pybsddb。我也打算用py2exe。 但我不确定法律影响。我看过商业产品只要是用python写的就不
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 7 年前。 Improve this qu
我有一个在 OS X 上用 python 2.7.2 开发的应用程序。我使用模块 shelve 并且在 mac 上似乎默认为 bsddb。该程序不会在装有 ActiveState python 2.7
我对 python 完全陌生,当我尝试导入 bsdddb 时出现此消息 Traceback (most recent call last): File "", line 1, in File
我正在尝试读取由 reprepro 创建的数据库文件。我对 bdb 没有那么多经验,所以我在这里可能会感到困惑,但看起来数据库在某种程度上是分层的。 如果我简单地执行 btopen('path/to/
我正在使用 python 2.7.3 和 Berkeley DB 来存储数据。我没有找到关于该模块的太多信息,仅在 python docks 中。我看到那里描述了一些功能,但我没有看到关于如何从数据库
我有一个应用程序,我需要将 Python shelve pickled 字典文件转换为 JSON 文件。 import ujson, shelve with open("shelveFile", "r
在带有开发者工具的 Mac OS X 10.5 (Leopard) 上的默认 Python 安装上执行以下操作: noel ~ : python Python 2.5.1 (r251:54863, J
我有一个由 C 实现(python bsddb 模块)创建的 berkeley db 文件(*.bdb)。是否可以通过 Berkeley Db 的纯 Java 实现来读取此文件?我尝试使用 berke
我是一名优秀的程序员,十分优秀!