MCPcopy Create free account
hub / github.com/Tencent/MMKV / getDefaultMMKV

Function getDefaultMMKV

Android/MMKV/mmkv/src/main/cpp/flutter-bridge.cpp:185–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185MMKV_EXPORT void *getDefaultMMKV(int32_t mode, const char *cryptKey, bool aes256, size_t expectedCapacity,
186 int32_t enableKeyExpire, int32_t expiredInSeconds, bool enableCompareBeforeSet,
187 int32_t recover, uint32_t itemSizeLimit) {
188 MMKV *kv = nullptr;
189
190 auto config = MMKVConfig();
191 config.mode = (MMKVMode) mode;
192 config.aes256 = aes256;
193 config.expectedCapacity = expectedCapacity;
194 if (enableKeyExpire >= 0) {
195 config.enableKeyExpire = (enableKeyExpire != 0);
196 }
197 config.expiredInSeconds = expiredInSeconds;
198 config.enableCompareBeforeSet = enableCompareBeforeSet;
199 if (recover >= 0) {
200 config.recover = static_cast<MMKVRecoverStrategic>(recover);
201 }
202 config.itemSizeLimit = itemSizeLimit;
203
204 if (cryptKey) {
205 string crypt = cryptKey;
206 if (crypt.length() > 0) {
207 config.cryptKey = &crypt;
208 kv = MMKV::defaultMMKV(config);
209 }
210 }
211 if (!kv) {
212 kv = MMKV::defaultMMKV(config);
213 }
214
215 return kv;
216}
217
218MMKV_EXPORT const char *mmapID(void *handle) {
219 MMKV *kv = static_cast<MMKV *>(handle);

Callers

nothing calls this directly

Calls 1

MMKVConfigClass · 0.50

Tested by

no test coverage detected