     
     return UInt(abs(hash))
   }
-  
-  private static func cacheURL(directory: String, filename: String) -> NSURL {
-    let fileMan = NSFileManager.defaultManager()
-    guard let path = fileMan.URLsForDirectory(.CachesDirectory, inDomains: .UserDomainMask).first else {
-      preconditionFailure()
-    }
-    
-    let fullPath = path.URLByAppendingPathComponent(directory, isDirectory: true)
-    do {
-      try fileMan.createDirectoryAtURL(fullPath, withIntermediateDirectories: true, attributes: nil)
-    } catch {
-      SGKLog.warn("TKTTPifierCache", text: "Could not create directory \(fullPath), due to: \(error)")
-    }
-
-    
-    let file = "\(filename).cache"
-    return fullPath.URLByAppendingPathComponent(file)
-  }
-}+}

import SwiftyJSON

enum TKTTPifierCache {
  // TODO: Re-use TKJSONCache

  
  static func problemId(forParas paras: [String: AnyObject]) -> String? {
    let hash = inputHash(paras)

    let hash = inputHash(paras)
    
    if let id = problemId(hash) {
      TKJSONCache.remove(id, directory: .Cache, subdirectory: solutionsDir)
    }
    TKJSONCache.remove("\(hash)", directory: .Cache, subdirectory: problemsDir)
  }

  static func solutionJson(forId id: String) -> JSON? {
    if let dict = TKJSONCache.read(id, directory: .Cache, subdirectory: solutionsDir) {
      return JSON(dict)
    } else {
      return nil
    }
  }
  
  static func save(solutionJson json: JSON, forId id: String) {
    guard let dict = json.dictionaryObject else {
      SGKLog.warn("TKTTPifierCache", text: "Could not turn json into dictionary. JSON: \(json)")
      return
    }
    TKJSONCache.save(id, dictionary: dict, directory: .Cache, subdirectory: solutionsDir)
  }
  
  private static func inputHash(input: [String: AnyObject]) -> UInt {
