 
                     // if can find styledImage in cache, no need to generate it again or save
 
-                    if let styledImage = self.cache.object(forKey: request.key) as? UIImage {
+                    if let styledImage = self.cache.object(forKey: request.key as NSString) {
                         self.completeRequest(request, withStyledImage: styledImage, cacheType: cacheType)
 
                     } else {

    fileprivate var requestPool = RequestPool()

    fileprivate let requestQueue = DispatchQueue(label: "com.nixWork.Navi.requestQueue", attributes: [])
    fileprivate let cacheQueue = DispatchQueue.global(priority: DispatchQueue.GlobalQueuePriority.background)

    fileprivate func completeRequest(_ request: Request, withStyledImage styledImage: UIImage, cacheType: CacheType) {



        let request = Request(avatar: avatar, completion: completion)

        if let image = sharedInstance.cache.object(forKey: request.key as NSString) {
            completion(true, image, .memory)

        } else {
            if let placeholderImage = avatar.placeholderImage {
