daltoniam / Skeets

Fetch, cache, and display images via HTTP in Swift.
Apache License 2.0
191 stars 21 forks source link

clearCache ignored? #26

Open longbowww opened 9 years ago

longbowww commented 9 years ago

I tried to just cache stuff 'per single run' of the application, so in appDelegate I did

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

    let paths = NSSearchPathForDirectoriesInDomains(.CachesDirectory, .UserDomainMask, true)
    ImageManager.sharedManager.cache.diskDirectory = "\(paths[0])/ImageCache"

    ImageManager.sharedManager.cache.clearCache()
}

interestingly, this has no effect whatsoever, when I change the picture behind mypath.com/test.png it will display an old cached version from last run

daltoniam commented 9 years ago

Interesting. Are you sure it isn't doing any kind of disk caching? The clearCache method only purges the in memory cache. If there is something cached on disk it will use that. I might try calling cleanDisk and clearCache see if that works.

longbowww commented 9 years ago

Did try both in appDelegate and in a ViewController -> no effect. :(

daltoniam commented 9 years ago

Well that is less than ideal. I will try and look at it as time permits.