XHNetworkCache: one line of code writes request data to the disk cache, and one line of xhnetworkcache

Source: Internet
Author: User

XHNetworkCache: one line of code writes request data to the disk cache, and one line of xhnetworkcache

XHNetworkCache


Version record (continuous update) 2016.07.01 Version 1.1 (update)

  • 1. added the interface for manually clearing the cache.
  • 2. added the interface for obtaining cache size.



2016.06.24 Version 1.0 (released) usage:
1. Write

[Objective-C] Check the source file copy code?
123 // Write data to the disk cache (parameter 1: JSON data returned by the server, parameter 2: Data request URL)// [Cache data by APP version number. data cached on the same interface for different apps of different versions does not interfere with each other][XHNetworkCache saveJsonResponseToCacheFile:responseObject andURL:URLString];





2. Get

[Objective-C] Check the source file copy code?
12 // Obtain the cached data (parameter: request URL, return: JSON data)id JsonCache = [XHNetworkCache cacheJsonWithURL:URLString];




3. Clear Cache

[Objective-C] Check the source file copy code?
12 // Clear Cache[XHNetworkCache clearCache];




4. Get the total cache size (M)

[Objective-C] Check the source file copy code?
12 // Obtain the total cache size (MB)float cacheSize = [XHNetworkCache cacheSize];




Install and manually add:

  • 1. Add the XHNetworkCache folder to the project directory.
  • 2. Import XHNetworkCache. h



CocoaPods:

  • 1. Add pod 'xhnetworkcache' to Podfile'
  • 2. Run pod install or pod update.
  • 3. Import XHNetworkCache. h



System Requirements

    • This project supports iOS 7.0 and Xcode 7.0 at the minimum.

Code:
Http://www.code4app.com/forum.php? Mod = viewthread & tid = 9145 & extra = page % 3D2% 26 filter % 3 Dsortid % 26 orderby % 3 Ddateline % 26 sortid % 3D1

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.