FastKV Save

FastKV is a real-time and high-performance persistent key-value store implemented by mmap. FastKV是由mmap实现的一个高实时性、高性能key-value持久化存储组件。

Project README

FastKV

Platform Version License MIT Gmail Twitter

中文介绍

Usage

[[FastKV defaultFastKV] setBool:YES forKey:@"key"];
[[FastKV defaultFastKV] setInteger:1 forKey:@"key"];
[[FastKV defaultFastKV] setObject:@"value" forKey:@"key"];

[[FastKV defaultFastKV] boolForKey:@"key"];
[[FastKV defaultFastKV] integerForKey:@"key"];
[[FastKV defaultFastKV] objectOfClass:NSString.class forKey:@"key"];

Memory Allocation

FastKV provides two kinds of memory allocation strategy.

typedef NS_ENUM(NSUInteger, FastKVMemoryStrategy) {
    FastKVMemoryStrategyDefault = 0,
    FastKVMemoryStrategy1,
};

Doubling FastKVMemoryStrategyDefault

size_t allocationSize = 1;
    while (allocationSize <= neededSize) {
        allocationSize *= 2;
    }
    return allocationSize;

Linear FastKVMemoryStrategy1

Reference python list

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

Installation

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

pod 'FastKV'

Benchmark

iPhone 8 64G, iOS 11.4

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

Benchmark

Author

yao.li, [email protected]

License

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

Open Source Agenda is not affiliated with "FastKV" Project. README Source: RyanLeeLY/FastKV
Stars
181
Open Issues
0
Last Commit
4 years ago
Repository
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating