With features:
-
multi-service, using the memory completely isolated;
-
support automatic serialization and de-serialization simplifies persistence;
-
long-lasting semi-automatic operation, refresh, Special Scene enforced;
-
supports concurrent execution of task execution queue;
-
support for policy control, multi-level storage;
-
support encryption / decryption operations;
具备特性:
-
支持多业务,使用到存储完全隔离;
-
支持自动序列化和反序列化,简化持久化;
-
持久化操作半自动,定时刷新,特殊场景强制执行;
-
支持任务执行队列化并发执行;
-
支持策略控制,多级存储;
-
支持加密/解密操作;
// 支持容器存储
self.itemList = [[TableHelper getSetItemTable] containerWithKey:@"setItemList"];
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.itemList removeObjectAtIndex:indexPath.row];
[[TableHelper getSetItemTable] synchronize];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft];
}
// 支持key-value值存储
@autoreleasepool {
NSMutableArray *tableArr = [NSMutableArray array];
int num = 0;
do {
NSString *key = [NSString stringWithFormat:@"SetOperation-%d", num];
ANKeyValueTable *table = [_tableDict objectForKey:key];
if (nil == table) {
table = [ANKeyValueTable tableWithName:key version:@"0.0.9" resumable:YES];
[_tableDict setObject:table forKey:key];
}
[tableArr addObject:table];
} while (10 > ++num);
NSInteger total = 10000;
NSInteger count = total;
while (count) {
for (ANKeyValueTable *t in tableArr) {
//int randNum = arc4random();
int randNum = (int)count;
NSString *key = [NSString stringWithFormat:@"Key-%d", randNum];
if (0 == type) {
[t setInt:randNum withKey:key];
} else {
[t setValue:@"ABCDEFGHIJKLMNOPQRSTVUWXYZ" withKey:key];
}
}
count--;
}
}
// 支持加解密
ANKeyValueTable *cTable = [ANKeyValueTable tableWithName:@"CryptContentTest" version:@"0.0.1" resumable:YES];
NSString *c1 = @"Content-CryptTest";
[cTable encryptContent:c1 withKey:@"Key-CryptTest"];
NSString *c2 = [cTable decryptContentWithKey:@"Key-CryptTest"];
NSAssert([c1 isEqualToString:c2], @"crypt test is not passed");
- https://github.com/SpringOx(GitHub)
- [email protected](Email)