TestsTested | ✓ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Jun 2015 |
Maintained by Tribus Hannes.
These are some helper classes to handle storing and retrieving of standard data structures
Or copy the THCache/
directory from this repo into your project.
With NSString
- (void)StringStorage {
[THCacher storeItemsToCache:@"ItemToStore" withKey:@"testStringStorageKey"];
NSString *itemToStore = [THCacher restoreItemsFromCacheWithKey:@"testStringStorageKey"]];
NSError *err;
[THCacher removeItemsFromCacheWithKey:@"testStringStorageKey"error:&err]
}
With NSArray
- (void)NSArrayStorage {
NSArray *array = @[@"ItemToStore", @"ItemToStore"];
[array storeArrayToCacheWithKey:@"testNSArrayStorageKey"];
array2 = [[NSArray alloc] initArrayFromCacheWithKey:@"testNSArrayStorageKey"];
NSError *err;
[array removeArrayFromCacheWithKey:@"testNSArrayStorageKey"error:&err];
}
With NSData
- (void)NSDataStorage {
NSData *data = [@"ItemToStore" dataUsingEncoding:NSUTF8StringEncoding];
[data storeDataToCacheWithKey:@"testNSDataStorageKey"];
[data initDataFromCacheWithKey:@"testNSDataStorageKey"];
NSError *err;
[data removeDataFromCacheWithKey:@"testNSDataStorageKey"error:&err];
}
With 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];
}
...are really welcome.
Source code of this project is available under the standard MIT license. Please see the license file.