Inherits from NSObject
Declared in EWCacheManager.h

Overview

The EWCacheManager class provides a singleton cache manager with convenience methods for downloading (via AFNetworking) and interacting with files stored in the app’s application support directory.

Class Methods

sharedManager

Returns the singleton cache manager.

+ (id)sharedManager

Declared In

EWCacheManager.h

Instance Methods

deleteFileInCache:

Checks to see if a file exists in the cache, and if so, deletes it.

- (void)deleteFileInCache:(NSString *)filename

Parameters

filename

The name of a cached file.

Declared In

EWCacheManager.h

downloadFileWithRequest:filename:success:failure:

Initiates a download request with the specified request and filename, executing success() and failure() as appropriate, if defined.

- (void)downloadFileWithRequest:(NSURLRequest *)request filename:(NSString *)filename success:(void ( ^ ) ( AFHTTPRequestOperation *operation , id responseObject ))success failure:(void ( ^ ) ( AFHTTPRequestOperation *operation , NSError *error ))failure

Parameters

request

The URL request to make.

filename

The filename where the data should be downloaded.

success

The block to execute upon sucessfully downloading the requested file.

failure

The block to execute upon failure (lost connection, data corruption, IO error, etc).

Declared In

EWCacheManager.h

hasFileInCache:

Returns a BOOL representing a file’s presence in the cache.

- (BOOL)hasFileInCache:(NSString *)filename

Parameters

filename

The name of a possibly cached file.

Return Value

YES if the file is present, otherwise NO.

Declared In

EWCacheManager.h

nameOfFileCurrentlyDownloading

Returns the name of the file currently being downloaded.

- (NSString *)nameOfFileCurrentlyDownloading

Return Value

The filename.

Declared In

EWCacheManager.h

pathForFilename:

Returns the full path for the cached file with the specified filename.

- (NSString *)pathForFilename:(NSString *)filename

Parameters

filename

The name of a cached file.

Declared In

EWCacheManager.h

sizeOfFileInCache:

Returns the size in bytes of the cached file, or 0 if the file is not found.

- (unsigned long long)sizeOfFileInCache:(NSString *)filename

Parameters

filename

The name of a cached file.

Declared In

EWCacheManager.h