THCache 0.9.1

THCache 0.9.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Jun 2015

Maintained by Tribus Hannes.



THCache 0.9.1

  • By
  • Hannes Tribus

Build Status

These are some helper classes to handle storing and retrieving of standard data structures

Installation

Manually

Or copy the THCache/ directory from this repo into your project.

Usage

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];
}

Contributions

...are really welcome.

License

Source code of this project is available under the standard MIT license. Please see the license file.