MMKV

An efficient, small mobile key-value storage framework developed by WeChat. Works on Android, iOS, macOS, Windows, and POSIX.

OTHER License

Stars
16.8K
Committers
50

Bot releases are visible (Hide)

MMKV - v1.3.4 Latest Release

Published by lingol 7 months ago

v1.3.4 / 2024-03-15

Changes for All platforms

  • Make trim() more robust in multi-process mode.

iOS & macOS

  • Support visionOS.

POSIX

  • Fix a compile error on ::unlink().
MMKV - v1.3.3

Published by lingol 9 months ago

v1.3.3 / 2024-01-25

Changes for All platforms

  • Add removeStorage() static method to safely delete underlying files of an MMKV instance.
  • Add protection from a potential crash of a multi-process MMKV loading due to the MMKV file not being valid.
  • Add back the lazy load feature. It was first introduced in v1.2.16. But it was rollbacked in v1.3.0 of potential ANR & file corruption. Now it's clear that the bug was caused by something else, it's time to bring it back.
  • Optimize loading speed by using shared inter-process lock unless there's a need to truncate the file size, which is rare.
  • Make these two lately added features more robust: customizing the initial file size & optimizing write speed when there's only one key inside MMKV.

Android

  • Fix a bug that null is returned when the value is in fact an empty ByteArray.
  • Fix AGP >= 8 package namespace error.
  • Fix the FastNative naming conflict.
  • Upgrade to SDK 34.
  • Upgrade androidx.annotation to v1.7.1.

iOS & macOS

  • On the Xcode 15 build, an App will crash on iOS 14 and below. Previously we have recommended some workarounds (check the v1.3.2 release note for details). Now you can use Xcode 15.1 to fix this issue.
  • Fix a bug that the multi-process mode won't configure correctly. It was introduced in v1.3.2.
  • Fix a macro naming conflict.
  • Avoid using a so-called privacy API when creating temp files.

POSIX

  • Fix a compile error on memcpy().

Golang

  • Fix a compile error when MMKV_DISABLE_CRYPT is on.
MMKV - v1.3.2

Published by lingol 11 months ago

v1.3.2 / 2023-11-20

Among most of the features added in this version, the credit goes to @kaitian521.

Changes for All platforms

  • Add the feature of customizing the initial file size of an MMKV instance.
  • Optimize write speed when there's only one key inside MMKV, the new key is the same as the old one, and MMKV is in SINGLE_PROCESS_MODE.
  • Optimize write speed by overriding from the beginning of the file instead of append in the back, when there's zero key inside MMKV, and MMKV is in SINGLE_PROCESS_MODE.
  • Add the feature of clearAll() with keeping file disk space unchanged, reducing the need to expand file size on later insert & update operations. This feature is off by default, you will have to call it with relative params or newly added methods.
  • Add the feature of comparing values before setting/encoding on the same key.
  • Fix a potential bug that the MMKV file will be invalid state after a successful expansion but a failure zeroFill(), will lead to a crash.
  • Fix a potential crash due to other module/static lib turn-off RTTI, which will cause MMKV to fail to catch std::exception.
  • Fix several potential crashes due to the MMKV file not being valid.

Android

  • Use the -O2 optimization level by default, which will reduce native lib size and improve read/write speed a little bit.
  • Experimantal use @fastNative annotation on enableCompareBeforeCompare() to speed up JNI call.

iOS & macOS

  • Optimize auto-clean logic to reduce lock waiting time.
  • Turn-off mlock() protection in background on iOS 13+. We have verified it on WeChat that the protection is no longer needed from at least iOS 13. Maybe iOS 12 or older is also not needed, but we don't have the chance to verify that because WeChat no longer supports iOS 12.

Known Issue

  • On Xcode 15 build, the App will crash on iOS 14 and below. The bug is introduced by Apple's new linker. The official solutions provided by Apple are either:
    • Drop the support of iOS 14.
    • Add -Wl,-weak_reference_mismatches,weak or -Wl,-ld_classic options to the OTHER_LDFLAGS build setting of Xcode 15. Note that these options are not recognized by older versions of Xcode.
    • Use older versions of Xcode, or wait for Xcode 15.2.
MMKV - v1.3.1

Published by lingol about 1 year ago

v1.3.1 / 2023-8-11

This is a hotfix version. It's highly recommended that v1.2.16 & v1.3.0 users upgrade as soon as possible.

Changes for All platforms

  • Fix a critical bug that might cause multi-process MMKV corrupt. This bug was introduced in v1.2.16.
  • Add the ability to filter expired keys on count() & allKeys() methods when auto key expiration is turn on.
  • Reduce the msync() call on newly created MMKV instances.
MMKV - v1.3.0

Published by lingol over 1 year ago

v1.3.0 / 2023-06-14

Changes for All platforms

  • Add auto key expiration feature. Note that this is a breaking change, once upgrade to auto expiration, the MMKV file is not valid for older versions of MMKV (v1.2.16 and below) to correctly operate.
  • Rollback the lazy load optimization due to reported ANR issues. It was introduced in v1.2.16.

iOS & macOS

  • Fix a potential memory leak on setting a new value for an existing key.
  • Upgrade min support target to iOS 11 / macOS 10.13 / tvOS 13 / watchOS 4.

Win32

  • Fix a bug that might fail to truncate the file size to a smaller size in some cases.

Flutter

  • The version of MMKV for Flutter is now the same as the MMKV native library.
MMKV - v1.2.16

Published by lingol over 1 year ago

v1.2.16 / 2023-04-20

Changes for All platforms

  • Optimization: The actual file content is lazy loaded now, saving time on MMKV instance creation, and avoiding lock waiting when a lot of instances are created at the same time.
  • Fix a bug when restoring a loaded MMKV instance the meta file might mistakenly report corrupted.

Android

  • Optimization: Remove unnecessary binder call on main process instantiation.

Flutter

  • Fix a crash on decoding an empty list.
  • Remove deprecated dependence.
  • Make the script more robust to fix the iOS Flutter plugin name.

Win32

  • Fix a string format bug on the MinGW64 environment.

golang

  • Fix a build error on 32-bit OS.
MMKV - v1.2.15

Published by lingol almost 2 years ago

v1.2.15 / 2023-01-12

Changes for All platforms

  • Log handler now handles all logs from the very beginning, especially the logs in initialization.
  • Log handler register method is now deprecated. It's integrated with initialize().
  • Fix a bug that lock()/unlock()/try_lock() is not thread-safe.

Flutter

  • Reduce the privacy info needed to obtain android sdkInt, avoid unnecessary risk on Android App Review.

iOS & macOS

  • Fix a compile error on macOS.
  • Fix a bug that some ObjC exceptions are not being caught.
  • Add assert on nil MMKV base path, protect from mis-using MMKV in global variable initialization.
  • Starting from v1.2.15, one must call +[MMKV initializeMMKV:] manually before calling any MMKV methods.

golang

  • Fix a compile error on GCC.

Win32

  • Support CMake project on Windows.
MMKV - v1.2.14

Published by lingol about 2 years ago

v1.2.14 / 2022-08-10

Changes for All platforms

  • Fix a bug that MMKV.getXXX() may return invalid results in multi-process mode.

Android

  • Return [] instead of null on empty StringSet from MMKV.decodeStringSet() methods.
  • Upgrade Android Compile & Target SDK to 32.

iOS

  • Protect from the crash in -[MMKV getObject:forKey:] method when the key-value doesn't exist.
MMKV - v1.2.13

Published by lingol over 2 years ago

v1.2.13 / 2022-03-30

Android

  • Fix crash on using Ashmem while MMKV_DISABLE_CRYPT macro is defined.

iOS

  • Add ability to retrieve key existece while getting value, aka -[MMKV getXXX:forKey:hasValue:] methods.

POSIX

  • Add ability to retrieve key existece while getting value, aka MMKV::getXXX(key, defaultValue, hasValue) methods.

Win32

  • Add ability to retrieve key existece while getting value, aka MMKV::getXXX(key, defaultValue, hasValue) methods.
MMKV - v1.2.12

Published by lingol almost 3 years ago

v1.2.12 / 2022-01-17

Changes for All platforms

  • Fix a bug that a subsequential clearAll() call may fail to take effect in multi-process mode.
  • Hide some OpenSSL symbols to prevent link-time symbol conflict, when an App somehow also static linking OpenSSL.

Android

  • Upgrade compileSdkVersion & targetSdkVersion from 30 to 31.
MMKV - v1.2.11

Published by lingol almost 3 years ago

v1.2.11 / 2021-10-26

Android

  • Due to increasing report about crash inside STL, we have decided to make MMKV static linking libc++ by default. Starting from v1.2.11, com.tencent:mmkv-static is the same as com.tencent:mmkv.
  • For those still in need of MMKV with shared linking of libc++_shared, you could use com.tencent:mmkv-shared instead.
  • Add backup & restore ability.

iOS / macOS

  • Add backup & restore ability.
  • Support tvOS.
  • Fix a compile error on some old Xcode.

Flutter (v1.2.12)

  • Add backup & restore ability.

POSIX / golang / Python

  • Add backup & restore ability.
  • Fix a compile error on Gentoo.

Win32

  • Add backup & restore ability.
MMKV - v1.2.10

Published by lingol over 3 years ago

v1.2.10 / 2021-06-25

This version is mainly for Android & Flutter.

Android

  • Complete JavaDoc documentation for all public methods, classes, and interfaces. From now on, you can find the API reference online.
  • Drop the support of armeabi arch. Due to some local build cache mistake, the last version (v1.2.9) of MMKV still has an unstripped armeabi arch inside. This is fixed.
  • Change MMKV.mmkvWithID() from returning null to throwing exceptions on any error.
  • Add MMKV.actualSize() to get the actual used size of the file.
  • Mark MMKV.commit() & MMKV.apply() as deprecated, to avoid some misuse after migration from SharedPreferences to MMKV.

Flutter (v1.2.11)

  • Bug Fixed: When building on iOS, occasionally it will fail on symbol conflict with other libs. We have renamed all public native methods to avoid potential conflict.
  • Keep up with MMKV native lib v1.2.10.
MMKV -

Published by lingol over 3 years ago

v1.2.9 / 2021-05-26

This version is mainly for Android & Flutter.

Android

  • Drop the support of armeabi arch. As has been mention in the last release, to avoid some crashes on the old NDK (r16b), and make the most of a more stable libc++, we have decided to upgrade MMKV's building NDK in this release. That means we can't support armeabi anymore. Those who still in need of armeabi can build from sources by following the instruction in the wiki.

We really appreciate your understanding.

Flutter (v1.2.10)

  • Bug Fixed: When calling MMKV.encodeString() with an empty string value on Android, MMKV.decodeString() will return null.
  • Bug Fixed: After upgrading from Flutter 1.20+ to 2.0+, calling MMKV.defaultMMKV() on Android might fail to load, you can try calling MMKV.defaultMMKV(cryptKey: '\u{2}U') with an encrytion key '\u{2}U' instead.
  • Keep up with MMKV native lib v1.2.9.
MMKV - v1.2.8

Published by lingol over 3 years ago

v1.2.8 / 2021-05-06

This will be the last version that supports armeabi arch on Android. To avoid some crashed on the old NDK (r16b), and make the most of a more stable libc++, we have decided to upgrade MMKV's building NDK in the next release. That means we can't support armeabi anymore.

We really appreciate your understanding.

Android

  • Migrate MMKV to Maven Central Repository. For versions older than v1.2.7 (including), they are still available on JCenter.
  • Add MMKV.disableProcessModeChecker(). There are some native crash reports due to the process mode checker. You can disable it manually.
  • For the same reason described above (native crashed), MMKV will now turn off the process mode checker on a non-debuggable app (aka, a release build).
  • For MMKV to detect whether the app is debuggable or not, when calling MMKV.initialize() to customize the root directory, a context parameter is required now.

iOS / macOS

  • Min iOS support has been upgrade to iOS 9.
  • Support building by Xcode 12.

Flutter

  • Support null-safety.
  • Upgrade to flutter 2.0.
  • Fix a crash on the iOS when calling encodeString() with an empty string value.

Known Issue on Flutter

  • When calling encodeString() with an empty string value on Android, decodeString() will return null. This bug will be fixed in the next version of Android Native Lib. iOS does not have such a bug.

Win32

  • Fix a compile error on Visual Studio 2019.
MMKV - v1.2.7

Published by lingol almost 4 years ago

v1.2.7 / 2020-12-25

Happy holidays everyone!

Changes for All platforms

  • Fix a bug when calling sync() with false won't do msync() asynchronous and won't return immediately.

Android

  • Fix an null pointer exception when calling putStringSet() with null.
  • Complete review of all MMKV methods about Java nullable/nonnull annotation.
  • Add API for MMKV.initialize() with both Context and LibLoader parammeters.

Flutter

  • Fix a crash on the iOS simulator when accessing the default MMKV instance.
  • Fix a bug on iOS when initing the default MMKV instance with a crypt key, the instance is still in plaintext.

Golang

Add golang for POSIX platforms. Most things actually work!. Check out the wiki for information.

MMKV - MMKV for Golang

Published by lingol almost 4 years ago

Add MMKV support for Golang on POSIX platforms. Most things actually work!
Check out the wiki for more info.

MMKV - v1.2.6

Published by lingol almost 4 years ago

v1.2.6 / 2020-11-27

Changes for All platforms

  • Fix a file corruption when calling reKey() after removeKeys() has just been called.

Android

  • Fix compile error when MMKV_DISABLE_CRYPT is set.
  • Add a preprocess directive MMKV_DISABLE_FLUTTER to disable flutter plugin features. If you integrate MMKV by source code, and if you are pretty sure the flutter plugin is not needed, you can turn that off to save some binary size.

Flutter

Add MMKV support for Flutter on iOS & Android platform. Most things actually work!
Check out the wiki for more info.

MMKV - v1.2.5

Published by lingol almost 4 years ago

v1.2.5 / 2020-11-13

This is a pre-version for Flutter. The official Flutter plugin of MMKV will come out soon. Stay Tune!

iOS / macOS

  • Fix an assert error of encrypted MMKV when encoding some <NSCoding> objects.
  • Fix a potential leak when decoding duplicated keys from the file.
  • Add +[MMKV pageSize], +[MMKV version] methods.
  • Add +[MMKV defaultMMKVWithCryptKey:], you can encrypt the default MMKV instance now, just like the Android users who already enjoy this for a long time.
  • Rename -[MMKV getValueSizeForKey:] to -[MMKV getValueSizeForKey: actualSize:] to align with Android interface.

Android

  • Fix a potential crash when getting MMKV instances in multi-thread at the same time.
  • Add MMKV.version() method.
MMKV - v1.2.4

Published by lingol almost 4 years ago

v1.2.4 / 2020-10-21

This is a hotfix mainly for iOS.

iOS / macOS

  • Fix a decode error of encrypted MMKV on some devices.

Android

  • Fix a potential issue on checking rootDir in multi-thread while MMKV initialization is not finished.
MMKV - v1.2.3

Published by lingol about 4 years ago

v1.2.3 / 2020-10-16

Changes for All platforms

  • Fix a potential crash on 32-bit devices due to pointer alignment issue.
  • Fix a decode error of encrypted MMKV on some 32-bit devices.

iOS / macOS

  • Fix a potential crc32() crash on some kind of arm64 devices.
  • Fix a potential crash after calling +[MMKV onAppTerminate].

Android

  • Fix a rare lock conflict on checkProcessMode().

POSIX

Add MMKV support for Python on POSIX platforms. Most things actually work!
Check out the wiki for more info.