- Categories for
UIWebView,MKWebview, adding cache management - An asynchronous cache downloader
- An asynchronous memory + disk cache caching with automatic cache expiration handling
- A background cache decompression
- A guarantee that the same URL won't be downloaded several times
- A guarantee that bogus URLs won't be retried again and again
- A guarantee that main thread will never be blocked
- Performances!
- Use GCD and ARC
- iOS 7.0 or later
- tvOS 9.0 or later
- watchOS 2.0 or later
- OS X 10.8 or later
- Xcode 7.3 or later
- Read this Readme doc
- Read the How to use section
- Read the documentation @ CocoaDocs
- Try the example by downloading the project from Github or even easier using CocoaPods try
pod try DPWebViewLocalCache - Get to the installation steps
- Find out who uses DPWebViewLocalCache and add your app to the list.
- If you need help, use Stack Overflow. (Tag 'DPWebViewLocalCache')
- If you'd like to ask a general question, use Stack Overflow.
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
Objective-C:
#import <DPLocalCache.h>
...
- (void)viewDidLoad {
//Any place to add only once!!!
//添加浏览器本地缓存处理
DPLocalCache *urlCache = [[DPLocalCache alloc] initWithMemoryCapacity:20 * 1024 * 1024
diskCapacity:200 * 1024 * 1024
diskPath:nil
cacheTime:60*60*24
modeTybe:DOWNLOAD_MODE
subDirectory:@"PXPT"];
[NSURLCache setSharedURLCache:urlCache];
}
- (void)didReceiveMemoryWarning{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
//Any place to add only once!!!
DPLocalCache *urlCache = (DPLocalCache *)[NSURLCache sharedURLCache];
[urlCache deleteCacheFolder];
}
...
There are three ways to use DPWebViewLocalCache in your project:
- using CocoaPods
- using Carthage
- by cloning the project into your repository
CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries in your projects. See the Get Started section for more details.
platform :ios, '7.0'
pod 'DPWebViewLocalCache', '~> 1.1.6'
If you are using Swift, be sure to add use_frameworks! and set your target to iOS 8+:
platform :ios, '8.0'
use_frameworks!
At this point your workspace should build without error. If you are having problem, post to the Issue and the community can help you solve it.
All source code is licensed under the MIT License.

