     return nil
   }
   
-  func cacheWrite(url:NSURL,image:UIImage) {
+  private func cacheWrite(url:NSURL,image:UIImage) {
     if cache.count < maxCount {
       cache.append(cacheImage(image: image, timeStamp: now, url: url))
     } else {

  }
}

class PIImageCache {
  
  init() {
    maxCount = 10
    maxByteSize = 3 * 1024 * 1024 //3MB
  }
  
  init(maxCount: Int, maxByteSize: Int) {
    self.maxCount = maxCount
    self.maxByteSize = maxByteSize
  }
  
  class var shared: PIImageCache {
    struct Static {
      static let instance: PIImageCache = PIImageCache()
    }
    return Static.instance
  }
  
  struct cacheImage {
    let image     :UIImage
    var timeStamp :Double
    let url       :NSURL
  }
  
  var now: Double {
    get {
      return NSDate().timeIntervalSince1970
    }
  }
  
  let maxCount : Int
  let maxByteSize  : Int
  
  var cache : [cacheImage] = []
  
  func cacheRead(url: NSURL) -> UIImage? {
    for var i=0; i<cache.count; i++ {
      if url == cache[i].url {
        cache[i].timeStamp = now

    }
  }
  
  internal func download(url: NSURL) -> (UIImage, byteSize: Int)? {
    var err: NSError?
    var maybeImageData = NSData(contentsOfURL: url, options:.UncachedRead, error: &err)
    if let e = err { println(e) }
