cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmo...@apache.org
Subject [7/50] ios commit: [CB-2275] Add NSURLCache to app template.
Date Mon, 25 Feb 2013 13:41:02 GMT
[CB-2275] Add NSURLCache to app template.


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/4001ae13
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/4001ae13
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/4001ae13

Branch: refs/heads/multipart_plugin_result
Commit: 4001ae13fcb1fcbe73168327630fbc0ce44703d0
Parents: 299a324
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Wed Feb 13 12:38:20 2013 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Wed Feb 13 12:38:20 2013 -0500

----------------------------------------------------------------------
 .../project/__TESTING__/Classes/AppDelegate.m      |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4001ae13/bin/templates/project/__TESTING__/Classes/AppDelegate.m
----------------------------------------------------------------------
diff --git a/bin/templates/project/__TESTING__/Classes/AppDelegate.m b/bin/templates/project/__TESTING__/Classes/AppDelegate.m
index 6dc7bfc..318f793 100644
--- a/bin/templates/project/__TESTING__/Classes/AppDelegate.m
+++ b/bin/templates/project/__TESTING__/Classes/AppDelegate.m
@@ -43,6 +43,11 @@
 
     [cookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
 
+    int cacheSizeMemory = 8 * 1024 * 1024; // 8MB
+    int cacheSizeDisk = 32 * 1024 * 1024; // 32MB
+    NSURLCache* sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:cacheSizeMemory
diskCapacity:cacheSizeDisk diskPath:@"nsurlcache"];
+    [NSURLCache setSharedURLCache:sharedCache];
+
     self = [super init];
     return self;
 }
@@ -109,4 +114,9 @@
     return supportedInterfaceOrientations;
 }
 
+- (void)applicationDidReceiveMemoryWarning:(UIApplication*)application
+{
+    [[NSURLCache sharedURLCache] removeAllCachedResponses];
+}
+
 @end


Mime
View raw message