Need a method remove all keys but keep the file size not changed #1134
Replies: 8 comments
-
I need reuse the db instance without close it. keep the file size to reduce the IO overhead. |
Beta Was this translation helpful? Give feedback.
-
What do you mean by saying reduce IO overhead? Do you find MMKV's space expansion algorithm not working for you? |
Beta Was this translation helpful? Give feedback.
-
The file size reduced into 4KB after clear. I use 2 MMKV instance as log rotate at high speed, after one full then change to other one. In this case every time rotate the file size changed, I guess keep the file size not change but destroy the data inside it will avoid a lot system call and block time. |
Beta Was this translation helpful? Give feedback.
-
Why do you need two instances and rotate them? It's quite a strange usage. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I take it that you have set a size limit or key count limit per instance. How large is one file grow to, normally speaking? |
Beta Was this translation helpful? Give feedback.
-
Yes, I use count limit. the file size could be 10M to 100M depend the logs item size and MAX_LOG_ENTRY_LIMIT(adjustable). |
Beta Was this translation helpful? Give feedback.
-
Same feature is needed for me. A faster In another word, it will not do any system IO calls for better performance. If some groups of keys are inserted into MMKV together every time, we can first call |
Beta Was this translation helpful? Give feedback.
-
This is not a bug report but a future request.
I need a method to remove all keys, but not trim and truncate file size to DEFAULT_MMAP_SIZE.
any suggestions how to do it myself, or MMKV will consider add this future?
Beta Was this translation helpful? Give feedback.
All reactions