title: How to cache the image in swift using SDWebImage?
body: <p>I am fetching the image from firebase storage and want to cache it using <code>SDWebImage</code>, but in my <code>ViewController</code> it gets keep on downloaded. Please guide me how to cache the images</p>
  
  <pre><code> override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
          let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! demoCell
          cell.textDemo.text = images[indexPath.row]
  
          var images_list = [String]()
          images_list.append(images[indexPath.row])
          images_list.append(images[indexPath.row] + "1")
          let storage = Storage.storage().reference()
          var imagesarray = [URL]()
  
  
          for x in images_list{
          let storageRef = storage.child("images/\(x).jpg")
          storageRef.downloadURL { (url, error) in
              if let error = error{
                  print(error.localizedDescription)
              }
              else if let downloadURL = url?.absoluteString{
                  cell.imageDemo.image = SDImageCache.shared().imageFromCache(forKey: downloadURL)
                  print("Image Cached")
              }
              else{
                  cell.imageDemo.sd_setImage(with: url!, completed: nil)
              }
          }
      }
      return cell
      }
  </code></pre>