London Escorts sunderland escorts 1v1.lol unblocked yohoho 76 https://www.symbaloo.com/mix/yohoho?lang=EN yohoho https://www.symbaloo.com/mix/agariounblockedpvp https://yohoho-io.app/ https://www.symbaloo.com/mix/agariounblockedschool1?lang=EN
9.1 C
New York
Wednesday, November 13, 2024

ios – Why does URLCache require diskCapacity & memoryCapacity to be a lot better than the response to cache it?


I’ve the next code.

let customCache: URLCache = {
    let cacheSizeMemory = 512 * 1024 * 1024
    let cacheSizeDisk = 512 * 1024 * 1024
    return URLCache(memoryCapacity: cacheSizeMemory, diskCapacity: cacheSizeDisk, diskPath: "serverTest")
}()

let customSession: URLSession = {
    // Create a customized URLSessionConfiguration
    let sessionConfiguration = URLSessionConfiguration.default
    sessionConfiguration.urlCache = customCache
    sessionConfiguration.requestCachePolicy = .useProtocolCachePolicy

    // Create a customized URLSession with the configuration
    let customSession = URLSession(configuration: sessionConfiguration)
    return customSession
}()

Listed here are a number of of the headers for my response:

< content-length: 93828673
< cache-control: public, max-age=300

I anticipate due to these headers the machine to cache the response for five minutes. Nonetheless that is not what is going on.

Now once I change these variables to the next the cache does work:

let cacheSizeMemory = 512 * 1024 * 1024 * 5
let cacheSizeDisk = 512 * 1024 * 1024 * 5

This makes completely no sense to me as a result of the response is just 93,828,673 bytes, which is way lower than the utmost cache measurement of 536,870,912 bytes.

Does Apple set some sort of buffer or one thing the place a single response can solely take up x% of the cache or one thing like that? I am unable to discover any documentation that may recommend that, however it’s the one rationalization I can consider.

Related Articles

Social Media Auto Publish Powered By : XYZScripts.com