Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support in-memory caching for non-bitmap drawables. #1197

Open
colinrtwhite opened this issue Mar 11, 2022 · 4 comments
Open

Support in-memory caching for non-bitmap drawables. #1197

colinrtwhite opened this issue Mar 11, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@colinrtwhite
Copy link
Member

Is your feature request related to a problem? Please describe.
Coil's memory cache currently only supports storing Bitmaps. Notably, animated drawables (e.g. AnimatedImageDrawable and MovieDrawable) cannot be stored in the MemoryCache and must be re-decoded for each new image request.

Describe the solution you'd like
Support storing non-bitmap Drawables in MemoryCache.

Additional context
Any solution will likely have to be opt-in since unlike (immutable) Bitmaps, which can be used by multiple targets at the same time, animated drawables are often stateful and can't be used by multiple targets at the same time. This mean we need to remove the drawable from the memory cache when it's in-use and only re-add it once the Target finishes using it. Additionally, parameters like AnimationCallbacks and other listeners will have to be added to the memory cache key.

@vitorpamplona
Copy link

Would this issue also add support for AnimatedSVGs in AsyncImage with the SVGDecoder?

@hm-tamim
Copy link

Any update on this?

@tudou152
Copy link

Support storing NinePatchDrawable in MemoryCache

@Viish
Copy link

Viish commented Mar 13, 2024

Hi,

Any plan to do the same for BitmapDrawable?

Thanks in advance.
Cheers,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
5 participants