swift 3 NSCache does not work
<p>I currently upgrade to <code>Swift 3.0</code>. I'm not able to get the <code>NSCache</code> to work. </p>

<p>Below is the code I currently have. I don't see anything I'm missing I'm not sure exactly what I'm doing wrong.</p>

<pre><code> class myClass {
     let imageCache = NSCache()

    func downloadImageByUserId(userId:String,imageView:UIImageView){

        print(userId)
        fireBaseAPI().childRef("version_one/frontEnd/users/\(userId)").observeEventType(.Value, withBlock: {snapshot in
            let imageUrl = snapshot.value!["profileImageUrl"] as! String

            // check image cache
            print(self.imageCache.objectForKey(imageUrl))
            if let cacheImage = self.imageCache.objectForKey(imageUrl) as? UIImage{
                print("image cache")
                imageView.image = cacheImage
                return
            }
            print("image not cache")
            //retrieve image
            let url = NSURL(string: imageUrl)

            NSURLSession.sharedSession().dataTaskWithURL(url!, completionHandler: { (data, resposn, error) in
                if error != nil {
                    print(error)
                    return
                }

                dispatch_async(dispatch_get_main_queue(),{
                    if let downloadImage:UIImage = UIImage(data: data!){
                        self.imageCache.setObject(downloadImage, forKey: imageUrl)
                       imageView.image = downloadImage
                    }
                })

            }).resume()
        })
    }
}
</code></pre>