Latest 0.9.1
Homepage https://github.com/hons82/THCache
License MIT
Platforms ios 6.1, requires ARC
Authors

Build Status
Pod Version
Pod Platform
Pod License
Coverage Status

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

Installation

CocoaPods

Install with CocoaPods by adding the following to your Podfile:

platform :ios, '6.1'
pod 'THCache', '~> 0.9.1'

Note: We follow http://semver.org for versioning the public API.

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.

Latest podspec

{
    "name": "THCache",
    "version": "0.9.1",
    "summary": "Helper classes to handle storing/retrieving of standard data structures",
    "homepage": "https://github.com/hons82/THCache",
    "license": {
        "type": "MIT",
        "file": "LICENSE.md"
    },
    "authors": {
        "Hannes Tribus": "[email protected]"
    },
    "source": {
        "git": "https://github.com/hons82/THCache.git",
        "tag": "v0.9.1"
    },
    "platforms": {
        "ios": "6.1"
    },
    "requires_arc": true,
    "source_files": "THCache/Code/*.{h,m}"
}

Pin It on Pinterest

Share This