-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
posix_setup_cn
MMKV 是基于 mmap 内存映射的 key-value 组件,底层序列化/反序列化使用 protobuf 实现,性能高,稳定性强。从 2015 年中至今在微信上使用,其性能和稳定性经过了时间的验证。近期也已移植到 Android / macOS / Windows / POSIX 平台,一并开源。
- MMKV 支持 Linux(Ubuntu, Arch Linux, CentOS, Gentoo)、Unix(macOS, FreeBSD, OpenBSD) 等 POSIX 平台;
- MMKV 需使用 CMake 3.8.0 或以上进行编译;
- C++ 编译器需支持 C++ 20 标准。
-
获取 MMKV 源码:
git clone https://github.com/Tencent/MMKV.git
-
打开你项目的
CMakeLists.txt
, 添加这几行:add_subdirectory(mmkv/POSIX/src mmkv) target_link_libraries(MyApp mmkv)
-
添加头文件
#include "MMKV.h"
,就可以愉快地开始你的 MMKV 之旅了。
注意:
-
你也可以编译运行 demo 工程来测试 MMKV:
cd mmkv/POSIX mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release .. make cd demo && ./demo
-
MMKV 依赖 zlib 库。如果你的系统没有安装 zlib1g-dev 库也不用担心,MMKV 会使用内置的精简版(zlib v1.2.11)。
-
如果你确定不需要加密功能,你可以在
Core/MMKVPredef.h
文件中打开宏MMKV_DISABLE_CRYPT
,以减小一些二进制大小。
MMKV is published under the BSD 3-Clause license. For details check out the LICENSE.TXT.
Check out the CHANGELOG.md for details of change history.
If you are interested in contributing, check out the CONTRIBUTING.md, also join our Tencent OpenSource Plan.
To give clarity of what is expected of our members, MMKV has adopted the code of conduct defined by the Contributor Covenant, which is widely used. And we think it articulates our values well. For more, check out the Code of Conduct.
Check out the FAQ first. Should there be any questions, don't hesitate to create issues.
User privacy is taken very seriously: MMKV does not obtain, collect or upload any personal information. Please refer to the MMKV SDK Personal Information Protection Rules for details.
- In English
- 中文
- In English
- 中文
- In English
- 中文
-
In English
-
中文
-
Golang