 
 //TODO try to use NSURLCache?
 //example - https://github.com/Alamofire/AlamofireImage
-private func imageDataToUIImageBinder() -> SmartDataLoaderFields<NSURL, UIImage, NSHTTPURLResponse>.JAsyncBinderForIdentifier
-{
+private func imageDataToUIImageBinder() -> SmartDataLoaderFields<NSURL, UIImage, NSHTTPURLResponse>.JAsyncBinderForIdentifier {
+
     return { (url: NSURL) -> AsyncTypes2<(DataRequestContext<NSHTTPURLResponse>, NSData), UIImage, NSError>.AsyncBinder in
 
         return { (imageData: (DataRequestContext<NSHTTPURLResponse>, NSData)) -> AsyncTypes<UIImage, NSError>.Async in

            cache                     : createImageCacheAdapter() ,
            cacheDataLifeTimeInSeconds: self.dynamicType.cacheDataLifeTimeInSeconds
        )
        
        let loader = jSmartDataLoaderWithCache(args)
        
        return bindTrySequenceOfAsyncs(loader, { (error: NSError) -> AsyncTypes<UIImage, NSError>.Async in
            
            let resultError = CacheLoadImageError(nativeError: error)
            return async(error: resultError)
        })
    }
    
    private static var cacheDataLifeTimeInSeconds: NSTimeInterval {
        
        let dbInfoByNames = Caches.sharedCaches().dbInfo.dbInfoByNames
        let info = dbInfoByNames.infoByDBName(Caches.thumbnailDBName())!
        return info.timeToLiveInHours * 3600.0
    }
    
    final private class ImageCacheAdapter : CacheAdapter {
        
        init() {
            
            let cacheFactory = { () -> CacheDB in
                return Caches.sharedCaches().createThumbnailDB()
            }
            
            super.init(cacheFactory: cacheFactory, cacheQueueName: cacheQueueName)
        }
        
        override func loaderToSetData(data: NSData, forKey key: String) -> AsyncTypes<Void, NSError>.Async {
            
            let loader = super.loaderToSetData(data, forKey:key)
            return Transformer.transformLoadersType1(loader, transformer: balanced)
        }
        
        override func cachedDataLoaderForKey(key: String) -> AsyncTypes<(date: NSDate, data: NSData), NSError>.Async {
            
            let loader = super.cachedDataLoaderForKey(key)
            return Transformer.transformLoadersType2(loader, transformer: balanced)
        }
    }
    
    private func createImageCacheAdapter() -> ImageCacheAdapter {

        let result = ImageCacheAdapter()

    }

    @objc public func onMemoryWarning(notification: NSNotification) {

        resetCache()
    }

