Intervjuu abi
Intervjuu ettevalmistamine
Jätka
Tööotsing
Vahendid
Tellimus
ET
Telegramm
Logi sisse
Ava menüü
Intervjuu abi
AI assistent
Brauseri laiendus
Vahendid
Laadi alla
KKK / Abi
Intervjuu ettevalmistamine
Küsimuste pank
Intervjuupank
Näidisintervjuud
Mentorid
Vahendid
KKK / Abi
Tööotsing
Tööotsingu automatiseerimine
Turuanalüüs
Tööpakkumised Telegramist
Vahendid
Karjäär
Blogi
KKK / Dokumentatsioon
Telegrami ajaveeb
Telegrami tugi
Juriidiline
Tagasimakse
Tingimused
Privaatsus
Õiguste omanikud
Tagasi küsimuste juurde
Küsimuste pank
iOS - Arendaja
küsimus
Middle+
import UIKit protocol CacheProtocol { associatedtype Value func setValue(_ value: Value?, forKey key: String) func getValue(forKey key: String) -> Value? func fetchValue(forKey key: String, completion: @escaping (Value?) -> Void) } final class Cache<T>: CacheProtocol { private var storage: [String: T] = [:] private let queue = DispatchQueue(label: "my.queue", attributes: .concurrent) func setValue(_ value: T?, forKey key: String) { queue.sync(flags: .barrier) { storage[key] = value } } func getValue(forKey key: String) -> T? { queue.sync { return storage[key] } } func fetchValue(forKey key: String, completion: @escaping (T?) -> Void) { queue.async { let value = self.storage[key] completion(value) } } }
Märgi lõpetatuks
Eelmine
Edasi