ios - iOS - 禁用 Alamofire 缓存参数
问题描述
Alamofire 是否也缓存请求参数?
完成登录请求后,我打开我的 cache.db,它会显示我的用户名和密码参数。
alamofire 是默认缓存请求参数还是我的配置错误?
有什么方法可以仅为参数禁用缓存。因为目前我只为 .GET 请求启用缓存,因为它没有参数
解决方案
您可以禁用任何类型的缓存,如下所示,
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let emptyCache = URLCache(memoryCapacity: 0, diskCapacity: 0, diskPath: nil)
URLCache.shared = emptyCache
return true
}
推荐阅读
- machine-learning - Difference in PCA with Scikit-Learn and SVD
- swift - 我可以使用 Extension 在 swift 4.2 中结束方法名称吗?
- python-3.x - 运行时问题(非零退出条件)Python
- android - 将admob gradle添加到android应用程序时出现依赖冲突错误
- angular - 如何以角度从 httpInterceptor 错误处理程序服务获取组件名称?
- vb.net - 如何格式化从目录中检索并在 vb.net 的 datagridview 中显示的文本文件值
- google-apps-script - 批处理功能时谷歌脚本代码运行缓慢
- spring - Redis 缓存内存状态
- bash - 如何使用 sed 或 awk 在文件的特定行插入特定字符?
- python - 如何在 scikit-learn 中使用交叉验证获得预测概率