THCache 0.9.1

THCache 0.9.1

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最新发布2015年6月

Tribus Hannes维护。



THCache 0.9.1

  • 作者:
  • Hannes Tribus

Build Status

这些是一些辅助类,用于处理存储和检索标准数据结构

安装

手动

或者将此存储库中的 THCache/ 目录复制到您的项目中。

使用

使用 NSString

- (void)StringStorage {
    [THCacher storeItemsToCache:@"ItemToStore" withKey:@"testStringStorageKey"];
    NSString *itemToStore = [THCacher restoreItemsFromCacheWithKey:@"testStringStorageKey"]];

    NSError *err;
    [THCacher removeItemsFromCacheWithKey:@"testStringStorageKey"error:&err]
}

使用 NSArray

- (void)NSArrayStorage {
    NSArray *array = @[@"ItemToStore", @"ItemToStore"];
    [array storeArrayToCacheWithKey:@"testNSArrayStorageKey"];
    array2 = [[NSArray alloc] initArrayFromCacheWithKey:@"testNSArrayStorageKey"];

    NSError *err;
    [array removeArrayFromCacheWithKey:@"testNSArrayStorageKey"error:&err];
}

使用 NSData

- (void)NSDataStorage {
    NSData *data = [@"ItemToStore" dataUsingEncoding:NSUTF8StringEncoding];
    [data storeDataToCacheWithKey:@"testNSDataStorageKey"];
    [data initDataFromCacheWithKey:@"testNSDataStorageKey"];

    NSError *err;
    [data removeDataFromCacheWithKey:@"testNSDataStorageKey"error:&err];
}

使用 NSDictionary

- (void)testNSDictionaryStorage {

    NSDictionary *dictionary = @{@"Key1" : @"ItemToStore", @"Key2" : @"ItemToStore"};
    [dictionary storeDictionaryToCacheWithKey:@"testNSDictionaryStorageKey"];
    NSDictionary *dictionary2 = [[NSDictionary alloc] initDictionaryFromCacheWithKey:@"testNSDictionaryStorageKey"];

    NSError *err;
    [dictionary removeDictionaryFromCacheWithKey:@"testNSDictionaryStorageKey"error:&err];
}

贡献

...是非常受欢迎的。

许可证

此项目的源代码可在标准 MIT 许可证下获得。请参阅许可证文件