     }
     
     public func objectForKey(key: String) -> NSData? {
-        return nil
+        let now = NSDate()
+        let fileManager = NSFileManager.defaultManager()
+        var object: NSData?
+        lock()
+        if let fileURL = encodedFileURLForKey(key), let path = fileURL.path where fileManager.fileExistsAtPath(path) {
+            do {
+                object = try NSData(contentsOfURL: fileURL, options: .DataReadingMappedIfSafe)
+            }
+            catch {
+                let _ = try? fileManager.removeItemAtURL(fileURL)
+            }
+            
+            setFileModificationDate(now, forURL: fileURL)
+        }
+        unlock()
+        
+        return object
     }
     
     public func removeObjectForKey(key: String) {
     }
     
     public func trimBeforeDate(date: NSDate) {
+    }
+    
+    public func trimToSizeByDate(size: Double) {
     }
     
     public func removeAllObjects() {

    }
    
    public func setObject(object: NSData?, forKey: String) {
        if let _ = object {
            
        }
        else {
            removeObjectForKey(forKey)

    var cacheURL: NSURL!
}

#if os(ios) || os(watchos)
private struct DiskBackgroundTask {
    var taskIdentifier: UIBackgroundTaskIdentifier = UIBackgroundTaskInvalid
    
    static func start() -> DiskBackgroundTask {
        var task = DiskBackgroundTask()
        task.taskIdentifier = UIApplication.sharedApplication().beginBackgroundTaskWithExpirationHandler {
            let taskIdentifier = task.taskIdentifier
            task.taskIdentifier = nil
            UIApplication.sharedApplication().endBackgroundTask(taskIdentifier)
        }
    
        return task
    }
    
    func end() {
        let taskIdentifier = self.taskIdentifier
        self.taskIdentifier = nil
        UIApplication.sharedApplication().endBackgroundTask(taskIdentifier)
    }
}
#else
private struct DiskBackgroundTask {
    static func start() -> DiskBackgroundTask { return DiskBackgroundTask() }
    func end() {}
}
#endif
