Skip to content

TinyDB keep a full copy of the data in memory? #540

Answered by MrPigss
Anonynz asked this question in Q&A
Discussion options

You must be logged in to vote

The default JSONStorage basically Reads and writes the entire file from disk. There is some buffering and optimisation built into Python and even at the os level, but for the sake of simplicity you can assume there's nothing in memory.

The MemoryStorage keeps everything in memory, hence the name. But it doesn't sync to disk at all.

There are other Storage options that implement it in different ways. BetterJSONStorage for example keeps a copy in memory along with some other optimisations.

You can also take a look at the CachingMiddleware of TinyDB, this also read from memory.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Anonynz
Comment options

Answer selected by Anonynz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants