talira

Fast key-value storage for mobile and desktop apps, from WeChat

open sourceBSD-3-Clausefree

MMKV is a small key-value storage library made by Tencent for the WeChat app. It keeps values in memory-mapped files and encodes them with protobuf, so every write is saved at once with no sync or apply call, and on Android, Windows and POSIX systems several processes can read and write the same store. It ships for Android (Maven), iOS and macOS (CocoaPods and Swift Package Manager), Windows, POSIX systems and HarmonyOS NEXT, with experimental Kotlin Multiplatform support.

Problems it solves

  • SharedPreferences is slow and loses data when my Android app crashes
  • fast local key-value storage for an iOS app instead of UserDefaults
  • share small settings between processes of my Android app

Features

  • key-value storage for mobile apps that saves every write at once
  • memory-mapped files with protobuf encoding
  • multi-process access on Android, Windows and POSIX
  • adds about 30K to an iOS app and 50K per architecture to an Android app

Limitations

  • Since version 2.0 it no longer supports 32-bit architectures or Android API levels 21 and 22: those need the 1.3.x LTS series.1
  • Kotlin Multiplatform support is experimental, for Android and iOS only.1

Alternatives

The same job

These do what MMKV does.

  1. Realm Open source object database that runs inside mobile apps

Compare MMKV with the top 3