部分文件系统支持的数据结构? [英] Data structure that is partially filesystem-backed?

查看:116
本文介绍了部分文件系统支持的数据结构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在部分存在于磁盘上的类似哈希的数据结构的现有(Python)实现?或者,可以根据一些标准(如上次访问时间)将特定密钥保存到某些辅助存储?

Is there an existing (Python) implementation of a hash-like data structure that exists partially on disk? Or, can persist specific keys to some secondary storage, based on some criteria (like last-accessed-time)?

ex:密钥K中的数据没有以M毫秒的速度被访问;将其序列化为持久存储(磁盘?),并删除它。

ex: "data at key K has not been accessed in M milliseconds; serialize it to persistent storage (disk?), and delete it".

我被引用到这个,但我不知道我可以消化它。

I was referred to this, but I'm not sure I can digest it.

编辑:

recd两个很好的答案(sqlite; gdb)m;为了确定赢家,我必须等到我测试了两者。谢谢!!

I've recd two excellent answers (sqlite; gdb)m; in order to determine a winner, I'll have to wait until I've tested both. Thank you!!

推荐答案

转到SQLITE。您将面临的一个大问题是并发/文件损坏等,SQLite使得它们非常容易避免,因为它提供事务完整性。只需使用模式(主键字符串键,字符串值)定义单个表。 SQLite是非常快的,特别是如果将一束写入包装到一个事务中。

Go for SQLITE. A big problem that you will face down the road is concurrency/file corruption, etc and SQLite makes these very easy to avoid as it provides transactional integrity. Just define a single table with schema (primary key string key, string value). SQLite is insanely fast, especially if you wrap bunches of writes into a transaction.

GDBM IMHO还具有许可证问题,具体取决于您要做什么,而SQLite是公共域。

GDBM IMHO also has licence problems depending on what you want to do, whereas SQLite is public domain.

这篇关于部分文件系统支持的数据结构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆