项目作者: RyanLeeLY

项目描述 :
FastKV is a real-time and high-performance persistent key-value store implemented by mmap. FastKV是由mmap实现的一个高实时性、高性能key-value持久化存储组件。
高级语言: Objective-C
项目地址: git://github.com/RyanLeeLY/FastKV.git
创建时间: 2018-08-10T06:50:20Z
项目社区:https://github.com/RyanLeeLY/FastKV

开源协议:MIT License

关键词:
ios key-value mmap objective-c store

下载


FastKV

Platform
Version
License MIT
liyaoxjtu2013@gmail.com"">Gmail
Twitter

中文介绍

Usage

  1. [[FastKV defaultFastKV] setBool:YES forKey:@"key"];
  2. [[FastKV defaultFastKV] setInteger:1 forKey:@"key"];
  3. [[FastKV defaultFastKV] setObject:@"value" forKey:@"key"];
  4. [[FastKV defaultFastKV] boolForKey:@"key"];
  5. [[FastKV defaultFastKV] integerForKey:@"key"];
  6. [[FastKV defaultFastKV] objectOfClass:NSString.class forKey:@"key"];

Memory Allocation

FastKV provides two kinds of memory allocation strategy.

  1. typedef NS_ENUM(NSUInteger, FastKVMemoryStrategy) {
  2. FastKVMemoryStrategyDefault = 0,
  3. FastKVMemoryStrategy1,
  4. };

Doubling FastKVMemoryStrategyDefault

  1. size_t allocationSize = 1;
  2. while (allocationSize <= neededSize) {
  3. allocationSize *= 2;
  4. }
  5. return allocationSize;

Linear FastKVMemoryStrategy1

Reference python list

  1. size_t allocationSize = (neededSize >> 3) + (neededSize < 9 ? 3 : 6);
  2. return allocationSize + neededSize;

Installation

FastKV is available through CocoaPods. To install
it, simply add the following line to your Podfile:

  1. pod 'FastKV'

Benchmark

iPhone 8 64G, iOS 11.4

Time taken of 10,000 write operations, unit: ms

Benchmark

Author

yao.li, liyaoxjtu2013@gmail.com

License

FastKV is available under the MIT license. See the LICENSE file for more info.