Skip to content

Allow providing a custom cache key which overrides the url in pin_setImage(from: URL?) #630

@MilesV64

Description

@MilesV64

My server sends lots of signed URLs which means the PIN cache downloads new images every time since the signed URL is slightly different. I'd like to use a custom key that I pass in, and then the library would only use the URL for downloading the image, not for use as the cache key.

It could look like this:

// The latest signed url from my server
let myURL = self.imageURL 

// A string uniquing the image; if this changes then it means the image changed. 
// Otherwise it's the same image but could be a different URL due to signed URLs.
let id = self.imageID

// CacheKey would be optional so current library behavior is unchanged
// The library would then use the given id as the cache key, only using `myURL` if it needs to be downloaded
self.imageView.pin_setImage(from: myURL, cacheKey: id) 

Would this be possible? Is there any other way to get around handling lots of signed URLs without redownloading every time?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions