         WKInterfaceDevice.currentDevice().removeCachedImageWithName(key)
     }
     
-    private class func removeImageWithCacheStrategy(strategy : CacheStrategy) {
-        if contains([.FIFO, .LRU], strategy) {
+    private class func removeImageWithCacheStrategy(cacheType : CacheType) {
+        if contains([.FIFO, .LRU], cacheType) {
             var imageName : String?
             var imageTimeStamp : NSTimeInterval = 0.0
             for (key, timestamp) in getTimeStamps() {


private class ImageCache {
    
    private enum CacheStrategy {
        case FIFO
        case LRU
    }
    
    private static var cacheStrategy : CacheStrategy = .FIFO
    
    private class func setCachedImageData(imageData : NSData, cachedBlock: (key : String) -> Void) -> String {
        let imageKey = imageData.MD5() as String
        if (ImageCache.imageExists(imageKey)) {
            cachedBlock(key : imageKey)
            if (ImageCache.cacheStrategy == .LRU) {
                ImageCache.addTimeStamp(NSDate().timeIntervalSinceReferenceDate, key: imageKey)
            }
        } else {

import Foundation
import Darwin

public enum CacheType {
    case FIFO
    case LRU
}

private let DefaultCacheType : CacheType = .FIFO

public extension WKInterfaceImage {
    public func setCachedImage(image : UIImage, compression : CGFloat = 0.6, cacheType : CacheType = DefaultCacheType) -> String {
        return setCachedImageData(UIImageJPEGRepresentation(image, compression), cacheType: cacheType)
    }
    
    public func setCachedImageData(imageData : NSData, cacheType : CacheType = DefaultCacheType) -> String {
        return ImageCache.setCachedImageData(imageData, cacheType: cacheType, cachedBlock: { (key) -> Void in
            self.setImageNamed(key)
        })
    }
