Latest 0.1.0
Homepage https://github.com/vkrotin/CHSession
License MIT
Platforms ios 7.0
Frameworks UIKit, Foundation
Authors

Version
License
Platform

This Manager is designed for ease of cache management requests NSURLSession.
Valid GET, POST, HEAD requests.
It is possible to set the size of the allocated memory for the cache.
It is also possible to set the size of the allocated space for the cache on disk.
Cache management:
entry
reading
*cleaning

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Usage


#import "CHSessionManager.h"
// install Cash size
// AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [CHSessionManager setDefaultCapacity];
    ...

// Request in some class

// GET
[CHSessionManager getUrl:someURL
                  parameters:dict params, maybe nil
             timeoutInterval:HTTP_DEFAULT_TIMEOUT
                  cachPolicy:CHRequestReturnCacheDataElseLoad
           completionHandler:^(NSData *data, NSURLResponse *response){
               // do something with data or responce out code
           }errorHandler:^(NSError *error){
               // cath the error
           }];

// POST, while no cache
[CHSessionManager postUrl:someURL
                   parameters:dict params, maybe nil
              timeoutInterval:HTTP_DEFAULT_TIMEOUT
            completionHandler:^(NSData *data, NSURLResponse *response){
                // do something with data or responce out code
            } errorHandler:^(NSError *error){
               // cath the error
            }];

// HEAD
[CHSessionManager headUrl:someURL
                   parameters:nil
              timeoutInterval:HTTP_DEFAULT_TIMEOUT
            completionHandler:^(NSDictionary *headDictionary, NSURLResponse *responce){
                // do something with HEAD dictionary or responce out code
            }errorHandler:nil];

Installation

CHSession is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "CHSession"

Author

Aleksey Anisimov, [email protected]

License

CHSession is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "CHSession",
    "version": "0.1.0",
    "summary": "Cache Manager for request around NSURLSession",
    "description": "Cache Manager for GET, POST, HEAD request and manage this responce chache in memory or in disk.",
    "homepage": "https://github.com/vkrotin/CHSession",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Aleksey Anisimov": "[email protected]"
    },
    "source": {
        "git": "https://github.com/vkrotin/CHSession.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source_files": "CHSession/**/*",
    "frameworks": [
        "UIKit",
        "Foundation"
    ]
}

Pin It on Pinterest

Share This