Skip to content

Is it possible to override cache with post-processed nuke_display image? #854

@sureshjoshi

Description

@sureshjoshi

I run some processing on an image in nuke_display (to get animated webps running), but I would like to then cache that and never re-run it as it's pretty time consuming.

I can't see how I would overwrite the existing cache URL/request from nuke_display - but I can effectively do something similar if I handle caching in my collectionView/application logic.

My hope is to move all this into a plugin, so other people can make use of this too.

Edit: For extra clarity on my question: nuke_display provides a UIImage and Data - and the existing in-memory cache (which I would like to re-use if possible) does not provide a url or an ImageRequest to update the cache on. I can always create a new cache key, that's not a problem - but separately keeping the unprocessed and processed items in cache (for only a few large animated images on my page) seems wasteful.

    override func nuke_display(image: UIImage?, data: Data?) {
        ...
        ImageCache.shared[???] = myProcessedImage
        ...
    }

This might also be a role for ImageProcess - but I'm still digging through the codebase to understand the pros/cons of that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions