Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
开发者_JAVA百科Closed 9 years ago.
Improve this questionShort Question: Is there any nosql flat-file database available as sqlite?
Explanation: Flat file database can be opened in different processes to read, and keep one process to write. I think its perfect for read cache if there's no strict consistent needed. Say 1-2 secs write to the file or even memory block and the readers get updated data after that.
So I almost choose to use sqlite, as my python server read cache. But there's still one problem. I don't like to rewrite sqls again in another place and construct another copy of my data tables in sqlite just as the same as I did in PostgreSql which used as back-end database.
so is there any other choice?thanks!
Maybe shelve
? It's basically a key-value store where you can store python objects. http://docs.python.org/library/shelve.html
Or maybe you could just use the filesystem?
BerkeleyDB is a widely-used embedded database that's been around forever (it originally derived from the database library included in BSD, hence the name) and has excellent performance characteristics for many use cases (and caching is a frequently-used one), but it does have some significant limitations.
If you want to use it with Python, you'll probably want the externally-maintained pybsddb/bsddb3
library, not the deprecated bsddb
library included in Python 2.x (and no longer in 3.x).
It's currently owned by Oracle, but available under an open-source license. Do take careful note of licensing terms -- current versions are GPLish (and GPL-compatible), so make sure that's compatible with what you plan to do.
More information:
- http://en.wikipedia.org/wiki/BerkeleyDB
- http://en.wikipedia.org/wiki/Sleepycat_License
- http://www.oracle.com/us/products/database/berkeley-db/index.html
Something trivial but workable, if you are looking storage backed up key value data structure use pickled dictionary. Use cPickle for better performance if needed.
精彩评论