Skip to content

Instantly share code, notes, and snippets.

@quellish
Created January 26, 2016 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quellish/d1b6b4f6d6cdf2212db1 to your computer and use it in GitHub Desktop.
Save quellish/d1b6b4f6d6cdf2212db1 to your computer and use it in GitHub Desktop.
ProbedURLCache2.m
#import "ProbedURLCache.h"
#import "http_cache.h"
@implementation ProbedURLCache
- (nullable NSCachedURLResponse *)cachedResponseForRequest:(NSURLRequest *)request {
NSCachedURLResponse *result = nil;
int cached = 0;
result = [super cachedResponseForRequest:request];
if (result != nil){
cached = 1;
}
if (HTTP_CACHE_RESPONSE_FROM_CACHE_ENABLED()){
HTTP_CACHE_RESPONSE_FROM_CACHE([[[request URL] host] UTF8String], [[[request URL] path] UTF8String], cached);
}
return result;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment