mrousavy / react-native-mmkv

⚡️ The fastest key/value storage for React Native. ~30x faster than AsyncStorage!
https://mrousavy.com
MIT License
6.15k stars 258 forks source link

The enableKeyExpire function and the expireDuration parameter are missing #615

Open davistsin opened 11 months ago

davistsin commented 11 months ago

MMKV provide function (Global Expiration)

// expire in a day
mmkv.enableAutoKeyExpire(MMKV.ExpireInDay); // MMKV.ExpireInDay = 24 * 60 * 60
// enable auto key expiration without global duration
mmkv.enableAutoKeyExpire(MMKV.ExpireNever); // MMKV.ExpireNever = 0

And support set function parameter uint32_t expireDuration

bool MMKV::set(int32_t value, MMKVKey_t key, uint32_t expireDuration) {
}

But not seen in this library.

I hope react-native-mmkv can support those feature.

davistsin commented 11 months ago

Also wanna add trim() function.

The totalSize() of an MMKV instance won't reduce after deleting key-values, call this method after lots of deleting if you care about disk usage. Note that clearAll() has a similar effect.
mrousavy commented 11 months ago

Also wanna add trim() function.

https://github.com/mrousavy/react-native-mmkv/pull/461

mrousavy commented 9 months ago

Not in my free time, no

zaferatli commented 3 months ago

i could help about this, @mrousavy this enhancement is it ok for you?