     }
 }
 
-    // MARK: Clean
+// MARK: Clean
 
 extension DataCache {
     


import UIKit

public class DataCache {
    private static let cacheDirectoryPrefix = "com.nch.cache."
    private static let ioQueuePrefix = "com.nch.queue."

        return readObjectForKey(key) as? Dictionary<String, AnyObject>
    }
    
    // MARK: Read & write image
    
    /// Write image for key. Please use this method to write an image instead of `writeObject(_:forKey:)`
    public func writeImage(image: UIImage, forKey key: String, format: ImageFormat? = nil) {
        var data: NSData? = nil
        
        if let format = format where format == .PNG {
            data = UIImagePNGRepresentation(image)
        }
        else {
            data = UIImageJPEGRepresentation(image, 0.9)
        }
        
        if let data = data {
            writeData(data, forKey: key)
        }
    }
    
    /// Read image for key. Please use this method to write an image instead of `readObjectForKey(_:)`
    public func readImageForKey(key: String) -> UIImage? {
        let data = readDataForKey(key)
        if let data = data {
            return UIImage(data: data, scale: 1.0)
        }
        
        return nil
    }
}

// MARK: Utils
