Add cache strategy feature
See original GitHub issueHello there 👋
It seems that it’s not possible to control how animations are cached by Lottie.
I’m using multiple Lottie animations in my app. All of them are cached in memory and take a lot a memory involving OutOfMemory errors. Currently, we can’t control which animation are cache in memory or disable this feature completely.
I’ve seen a lottie_cacheStrategy
attribute in LottieAnimationView code but it doesn’t seem to exist anymore 😢 . Why has it been removed?
Here’s a sample of a memory dump showing the excessive amount of memory used by Lottie:
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:10
Top Results From Across the Web
Caching strategies - Amazon ElastiCache - AWS Documentation
The write-through strategy adds data or updates data in the cache whenever data is written to the database. Advantages and disadvantages of write-through....
Read more >Set Up a Caching Strategy | MuleSoft Documentation
You can create a caching strategy from a Cache scope properties panel or a Global Elements configuration in Anypoint Studio. After you create...
Read more >Working with the feature cache—ArcMap
First, pan and zoom your map to the area where you will be working. · On the main menu, click Customize > Toolbars...
Read more >All things caching- use cases, benefits, strategies, choosing a ...
So in this post, I try to explain different parameters that help you decide a technology, also we discuss features & some real-world...
Read more >Caching Strategies - CircleCI
Cache storage customization · Cache optimization · Partial dependency caching strategies · Caching strategy tradeoffs · Using a lock file · Using multiple...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Unfortunately, URLs are still being cached and PR #1450 did not fix this. Let me quickly outline the problem. When the
cacheKey
isnull
, the cache function of theLottieCompositionFactory
recognized and honors this case: https://github.com/airbnb/lottie-android/blob/ee942249214dd6bb1540b746ca0b678a6382b5ee/lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java#L459-L474Therefore a new network fetch is initiated, as it should be: https://github.com/airbnb/lottie-android/blob/ee942249214dd6bb1540b746ca0b678a6382b5ee/lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java#L80-L88
However, the
NetworkFetcher
looks in it’s cache and returns the cached file, i.e., the end user still sees the wrong animation. IMHO the NetworkFetcher needs to be adjusted to honor the no cache flag, too: https://github.com/airbnb/lottie-android/blob/master/lottie/src/main/java/com/airbnb/lottie/network/NetworkFetcher.java#L42there is no such things ,anyway i can’t find it . and lottie_cacheStrategy and cacheStrategy , it should have been removed. but in LottieCompositionFactory.fromUrl it still have LottieCompositionCache,however,it can’t control the size of local cache in appContext.getCacheDir()