All Projects → CoderZhuXH → Xhnetworkcache

CoderZhuXH / Xhnetworkcache

Licence: mit
一行代码将网络数据持久化 - 支持数据同步/异步写入及更新、缓存数据读取、获取缓存数据大小、缓存数据清除.

Labels

Projects that are alternatives of or similar to Xhnetworkcache

Thpdfkit
PDF viewer component on top of Apples PDFKit
Stars: ✭ 68 (-61.8%)
Mutual labels:  pod
K8s
Deploying Kubernetes High Availability Cluster with Ansible Playbook
Stars: ✭ 125 (-29.78%)
Mutual labels:  pod
Filebeat Kubernetes
Filebeat container, alternative to fluentd used to ship kubernetes cluster and pod logs
Stars: ✭ 147 (-17.42%)
Mutual labels:  pod
Rsformview
A Cocoapods library designed to easily create forms with multiple data entry fields
Stars: ✭ 84 (-52.81%)
Mutual labels:  pod
Php K8s
PHP K8s is a PHP handler for the Kubernetes Cluster API, helping you handling the individual Kubernetes resources directly from PHP, like viewing, creating, updating or deleting resources.
Stars: ✭ 111 (-37.64%)
Mutual labels:  pod
Ckube
A cli to simplify working with kubectl for some common workflows
Stars: ✭ 127 (-28.65%)
Mutual labels:  pod
Fwcyclescrollview
轮播控件:支持本地图片、网络图片、自定义视图,轮播分页控件有多重可选方案,轮播次数、间隔时间也可设置,更多配置请参考”可设置参数“。提供OC使用Demo。
Stars: ✭ 59 (-66.85%)
Mutual labels:  pod
Zztools
包括: StarView星星评价(支持半星, 整星, 任意星, 支持拖动, 支持自定义星星图片, 数量, 大小, 间距, 最低分值). 瀑布流(垂直, 浮动, 混合模式瀑布流)等.
Stars: ✭ 175 (-1.69%)
Mutual labels:  pod
Fcipaddressgeocoder
iOS Geocoder for geocode device IP Address location using GeoIP service(s) and a block-based syntax. 💻🌍
Stars: ✭ 114 (-35.96%)
Mutual labels:  pod
Bekcurvetabbar
Full Customizable Tabbar with IBInspectables
Stars: ✭ 144 (-19.1%)
Mutual labels:  pod
Fwsidemenu
侧滑控件:支持左、右滑动的侧滑菜单,可配置单侧滑动,同时可配置菜单宽度等,更多配置请参考”可设置参数“。参考了QQ用户体验:支持边缘侧滑,解决手势冲突问题(边缘范围可设置)。提供OC使用Demo。
Stars: ✭ 90 (-49.44%)
Mutual labels:  pod
Fcuuid
iOS UUID / Universally Unique Identifiers library as alternative to UDID and identifierForVendor. 📱
Stars: ✭ 1,387 (+679.21%)
Mutual labels:  pod
Abexpandableview
Expandable, collapsible, filterable and single/multi selectable table view.
Stars: ✭ 138 (-22.47%)
Mutual labels:  pod
Swifttwitch
👾 The New Twitch API for iOS; wrapped in Swift goodness 👾
Stars: ✭ 72 (-59.55%)
Mutual labels:  pod
Xhtoast
简洁轻便提示工具,一行代码既可完成提示信息显示 - 支持自定义显示位置及停留时间
Stars: ✭ 152 (-14.61%)
Mutual labels:  pod
Whc pageviewkit
iOS平台轻量级的PageView组件,其中TitleBar拥有30多种UI样式
Stars: ✭ 59 (-66.85%)
Mutual labels:  pod
Luexpandabletableview
A subclass of UITableView with expandable and collapsible sections
Stars: ✭ 125 (-29.78%)
Mutual labels:  pod
Mobileproject
一个基于MVC的项目框架,并集成一些常用的功能(不断更新中)
Stars: ✭ 2,054 (+1053.93%)
Mutual labels:  pod
Uiimage Imagecompress
An iOS library to compress images and optimize uploads
Stars: ✭ 155 (-12.92%)
Mutual labels:  pod
Cocoapods Tips
iOS 라이브러리를 관리하는 CocoaPods Tip정보 모음입니다.
Stars: ✭ 141 (-20.79%)
Mutual labels:  pod

XHNetworkCache

一行代码持久化网络数据

AppVeyor Carthage compatible Version Status Support Pod Platform Pod License

==============

Swift版本请戳这里>>> https://github.com/CoderZhuXH/XHNetworkCacheSwift

技术交流群(群号:537476189)

更新记录:

  • 2020.01.10 -- v1.5.0 -->增加检测该数据是否已缓存接口...
  • 2017.09.30 -- v1.4.0 -->已知问题修复及优化...
  • 2017.06.16 -- v1.3.0 -->缓存及获取缓存接口增加请求参数(可选)...
  • 2016.09.04 -- v1.2.3 -->增加+(NSString *)cacheSizeFormat方法...
  • 2016.08.12 -- v1.2.1 -->增加获取缓存路径接口...
  • 2016.07.06 -- v1.2 -->增加异步写入/更新缓存接口...
  • 2016.07.01 -- v1.1 -->1.增加手动清除缓存接口;2.增加获取缓存大小接口...
  • 2016.06.24 -- v1.0

使用方法:

1.(同步)写入/更新

//将数据(同步)写入磁盘缓存(参数1:服务器返回的JSON数据, 参数2:数据请求URL,参数3:数据请求参数(没有传nil)
//[按APP版本号缓存,不同版本APP,同一接口缓存数据互不干扰]
    BOOL result = [XHNetworkCache saveJsonResponseToCacheFile:self.responseObject andURL:self.URL params:self.params];
    if(result)
    {
        NSLog(@"(同步)写入/更新缓存数据 成功");
    }
    else
    {
         NSLog(@"(同步)写入/更新缓存数据 失败");
    }

2.(异步)写入/更新

//将数据(异步)写入磁盘缓存(参数1:服务器返回的JSON数据, 参数2:数据请求URL,参数3:数据请求参数(没有传nil)
//[按APP版本号缓存,不同版本APP,同一接口缓存数据互不干扰]
    [XHNetworkCache save_asyncJsonResponseToCacheFile:self.responseObject andURL:self.URL params:self.params completed:^(BOOL result) {
        
        if(result)
        {
            NSLog(@"(异步)写入/更新缓存数据 成功");
        }
        else
        {
            NSLog(@"(异步)写入/更新缓存数据 失败");
        }
        
    }];

3.该数据是否已缓存

//获取缓存数据(参数1:请求URL,参数2:请求参数,返回:YES已缓存,NO未缓存)
 BOOL result = [XHNetworkCache checkCacheWithURL:self.URL params:self.params];

4.获取缓存数据

//获取缓存数据(参数1:请求URL,参数2:请求参数,返回:JSON数据)
id JsonCache = [XHNetworkCache cacheJsonWithURL:self.URL params:self.params];

5.获取缓存路径

//获取缓存路径
 NSString *path = [XHNetworkCache cachePath];

6.清除缓存

//清除缓存
[XHNetworkCache clearCache];

7.获取缓存总大小(M)

//获取缓存大小(M)
float cacheSize = [XHNetworkCache cacheSize];
//或者(以..kb/..M)形式获取
NSString *cacheSizeFormat = [XHNetworkCache cacheSizeFormat];

安装

1.手动添加:

  • 1.将 XHNetworkCache 文件夹添加到工程目录中
  • 2.导入 XHNetworkCache.h

2.CocoaPods:

  • 1.在 Podfile 中添加 pod 'XHNetworkCache'
  • 2.执行 pod install 或 pod update
  • 3.导入 XHNetworkCache.h

3.Tips

  • 1.如果发现pod search XHLaunchAd 搜索出来的不是最新版本,需要在终端执行pod repo update命令更新本地spec缓存(需要几分钟),然后再搜索就可以了
  • 2.如果你发现你执行pod install后,导入的不是最新版本,请删除Podfile.lock文件,在执行一次 pod install

系统要求

  • 该项目最低支持 iOS 7.0 和 Xcode 7.0

许可证

XHNetworkCache 使用 MIT 许可证,详情见 LICENSE 文件
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].