         return rawKey.stringByReplacingOccurrencesOfString("/", withString: "--")
     }
 }
+
+extension Dictionary {
+    func keysSortedByValue(isOrderedBefore: (Value, Value) -> Bool) -> [Key] {
+        return Array(self).sort{ isOrderedBefore($0.1, $1.1) }.map{ $0.0 }
+    }
+}
public class DataCache {
    private static let cacheDirectoryPrefix = "com.nch.cache."
    private static let ioQueuePrefix = "com.nch.queue."
    
    public static var defaultCache = DataCache(name: "default")
    

        
        #if !os(OSX) && !os(watchOS)
            NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(DataCache.cleanExpiredDiskCache), name: UIApplicationWillTerminateNotification, object: nil)
            NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(DataCache.cleanExpiredDiskCache), name: UIApplicationDidEnterBackgroundNotification, object: nil)
        #endif
    }
    
