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

Function getDefaultMMKV

Android/MMKV/mmkv/src/main/cpp/native-bridge.cpp:406–437  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

404}
405
406MMKV_JNI jlong getDefaultMMKV(JNIEnv *env, jobject obj, jint mode, jstring cryptKey, jlong expectedCapacity,
407 jboolean aes256, jint enableKeyExpire, jint expiredInSeconds,
408 jboolean enableCompareBeforeSet, jint recover, jint itemSizeLimit) {
409 MMKV *kv = nullptr;
410
411 auto config = MMKVConfig();
412 config.mode = (MMKVMode) mode;
413 config.aes256 = aes256;
414 config.expectedCapacity = expectedCapacity;
415 if (enableKeyExpire >= 0) {
416 config.enableKeyExpire = (enableKeyExpire != 0);
417 }
418 config.expiredInSeconds = expiredInSeconds;
419 config.enableCompareBeforeSet = enableCompareBeforeSet;
420 if (recover >= 0) {
421 config.recover = static_cast<MMKVRecoverStrategic>(recover);
422 }
423 config.itemSizeLimit = itemSizeLimit;
424
425 if (cryptKey) {
426 string crypt = jstring2string(env, cryptKey);
427 if (crypt.length() > 0) {
428 config.cryptKey = &crypt;
429 kv = MMKV::defaultMMKV(config);
430 }
431 }
432 if (!kv) {
433 kv = MMKV::defaultMMKV(config);
434 }
435
436 return (jlong) kv;
437}
438
439MMKV_JNI jlong getMMKVWithAshmemFD(JNIEnv *env, jobject obj, jstring mmapID, jint fd, jint metaFD, jstring cryptKey,
440 jboolean aes256) {

Callers

nothing calls this directly

Calls 2

jstring2stringFunction · 0.70
MMKVConfigClass · 0.50

Tested by

no test coverage detected