     }
   }
   
-  var semaphore = dispatch_semaphore_create(1)
+  private var semaphore = dispatch_semaphore_create(1)
   
-  func perform(url: NSURL) -> (UIImage?, isCache:Bool) {
+  internal func perform(url: NSURL) -> (UIImage?, isCache:Bool) {
     dispatch_semaphore_wait(semaphore,DISPATCH_TIME_FOREVER)
     let maybeCache = cacheRead(url)
     dispatch_semaphore_signal(semaphore)


import UIKit

extension NSURL {
  func getImageWithCache(cache: PIImageCache) -> UIImage? {
    return cache.get(self)
  }
}

extension UIImageView {
  func imageOfURL(url: NSURL, cache: PIImageCache) {
    cache.get(url) {
      [weak self] img in
      self?.image = img

    return nil
  }
  
  public func get(url: NSURL) -> UIImage? {
    return perform(url).0
  }
  
  public func get(url: NSURL, then: (image:UIImage?) -> Void) {
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
      [weak self] in
      if let scope = self {
