Open DorianMazur opened 2 months ago
Guten Tag, Hans here.
[!NOTE] New features, bugfixes, updates and other improvements are all handled mostly by
@mrousavy
in his free time. To support@mrousavy
, please consider 💖 sponsoring him on GitHub 💖. Sponsored issues will be prioritized.
Well you can just load the MMKV
instance and check if there are any keys in it, no?
const instance = new MMKV({ id: 'some-id' })
const instanceExists = instance.getAllKeys().length > 0
console.log(instanceExists) // Should return true or false
Or maybe instance.size > 0
, this is size in bytes
I have encrypted instance, I need to check if instance exists before encrypting it. Initializing without encryption key will erase all data.
Initializing without encryption key will erase all data.
This is also a bit weird imo - that should throw an error instead of erasing all data..
Description:
Currently, there's no straightforward way to check if an MMKV instance with a specific ID already exists. This functionality would be useful for managing multiple MMKV instances and avoiding conflicts or unnecessary instance creation.
Feature request:
Add a static method to the MMKV class that allows checking for the existence of an instance with a given ID.
Proposed usage:
Benefits: