【问题标题】:What happens when URLCache limit is reached达到 URLCache 限制时会发生什么
【发布时间】:2018-03-03 01:51:05
【问题描述】:

我使用 URLCache 来缓存请求响应,最大容量如下:

    let diskCapacity =  100 * 1024 * 1024
    let memoryCapacity =  100 * 1024 * 1024
    let cache = URLCache(memoryCapacity: memoryCapacity, diskCapacity: diskCapacity, diskPath: nil)
    URLCache.shared = cache

但我想知道当达到限制时会发生什么。 它不会缓存新请求吗?还是会删除旧缓存? 我在文档上找不到任何内容:/

提前感谢您的帮助

【问题讨论】:

  • 自动释放对象。

标签: ios swift swift3 alamofire nsurlcache


【解决方案1】:

缓存中的对象将在达到限制时被释放。

【讨论】:

  • 感谢您的回答。所有对象都被删除?还是只有最老的?
猜你喜欢
  • 1970-01-01
  • 2023-03-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-03-23
相关资源
最近更新 更多