Skip to content

indragiek/ObjectiveKVDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ObjectiveKVDB

Objective-C wrapper for kvdb

ObjectiveKVDB is a super simple Objective-C wrapper for @dinhviethoa's kvdb, a key-value store written in C.

Submodule

To build the framework and run tests, the kvdb submodule needs to be cloned first by running:

git submodule update --init

Example Usage

All keys and values are stored as UTF-8 encoded string data. Only NSString keys and values are supported.

KVDBDatabase *db = [KVDBDatabase databaseWithPath:@"/path/to/database.db"];

// Store a value
db[@"some key"] = @"some value";

// Delete a value
db[@"some key"] = nil;

// Enumerate values
for (int i = 0; i < 20; i++) {
	NSString *stringValue = @(i).stringValue;
	self.db[stringValue] = stringValue;
}

[db enumerateKeysAndValuesUsingBlock:^(NSString *key, NSString *value, BOOL *stop) {
	NSLog(@"%@ : %@", key, value);
}];