[英]iOS - Disable Alamofire Cache parameters
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
}
您可以按以下方式禁用alamofire中的緩存。
Alamofire.Manager.sharedInstance.session.configuration.requestCachePolicy = .ReloadIgnoringLocalCacheData
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.