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

Feature: Add clear image cache from memory and disk #425

Merged

Conversation

guhungry
Copy link
Contributor

@guhungry guhungry commented Mar 9, 2019

I have a use case that need to clear image cache after user logout
I tested it on both android and iOS

@codecov
Copy link

codecov bot commented Mar 9, 2019

Codecov Report

Merging #425 into master will decrease coverage by 7.75%.
The diff coverage is 60%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #425      +/-   ##
==========================================
- Coverage   94.11%   86.36%   -7.76%     
==========================================
  Files           1        1              
  Lines          17       22       +5     
==========================================
+ Hits           16       19       +3     
- Misses          1        3       +2
Impacted Files Coverage Δ
src/index.js 86.36% <60%> (-7.76%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 89c0e2e...2b79960. Read the comment docs.

@codecov
Copy link

codecov bot commented Mar 9, 2019

Codecov Report

Merging #425 (4ab44eb) into master (325d77f) will decrease coverage by 8.28%.
The diff coverage is 50.00%.

❗ Current head 4ab44eb differs from pull request most recent head 590b036. Consider uploading reports for the commit 590b036 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #425      +/-   ##
==========================================
- Coverage   95.23%   86.95%   -8.29%     
==========================================
  Files           1        1              
  Lines          21       23       +2     
  Branches        2        0       -2     
==========================================
  Hits           20       20              
- Misses          1        3       +2     
Impacted Files Coverage Δ
src/index.js 86.95% <50.00%> (ø)
src/index.tsx

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4fc024b...590b036. Read the comment docs.

@macdevnet
Copy link

This is a pretty useful addition. Any thoughts on if it is going to be accepted?

@Palid
Copy link

Palid commented Apr 4, 2019

+1 on this, I'd love this addition to the library.

@guhungry guhungry force-pushed the feature_clear_cache_memory_and_disk branch from 2b79960 to 4ab44eb Compare May 9, 2019 03:50
luatnd added a commit to luatnd/react-native-fast-image that referenced this pull request Jul 18, 2019
@brunocrpontes
Copy link

Any expectations about when it will be merged?

@barrylachapelle
Copy link

+1 would love this for development/testing

@ntelkedzhiev
Copy link

Any updates on this?

@lx3133584
Copy link

This is a pretty useful addition

@hanayashiki
Copy link

Why wasn't this merged?

@guhungry guhungry force-pushed the feature_clear_cache_memory_and_disk branch 3 times, most recently from e0f48c3 to 28d06a5 Compare June 20, 2020 05:27
@guhungry
Copy link
Contributor Author

@DylanVann I rebase the code and use promise api as you suggest please review it.

@guhungry guhungry force-pushed the feature_clear_cache_memory_and_disk branch 2 times, most recently from dfe9aa2 to ee3f590 Compare June 20, 2020 07:13
@guhungry guhungry force-pushed the feature_clear_cache_memory_and_disk branch from ee3f590 to 1912be0 Compare June 20, 2020 07:22
@guhungry
Copy link
Contributor Author

Working example

Android
iOS 1) Load image & kill app & open app, clear mem, clear disk 2) kill app && open app

@tgensol
Copy link

tgensol commented Oct 27, 2020

Any updates on this one ?

@dandre-hound dandre-hound mentioned this pull request Feb 1, 2021
@zyestin
Copy link

zyestin commented Mar 2, 2021

Nice, Tks~
But, the version we're using is above 8.3.2, part of directory structure is as blow. So the file should make change also need to update. Will you update ?

node_modules/react-native-fast-image/android
node_modules/react-native-fast-image/dist
node_modules/react-native-fast-image/dist/index.cjs.js
node_modules/react-native-fast-image/dist/index.d.ts
node_modules/react-native-fast-image/dist/index.d.ts.map
node_modules/react-native-fast-image/dist/index.js
node_modules/react-native-fast-image/dist/index.js.flow
node_modules/react-native-fast-image/dist/index.test.d.ts
node_modules/react-native-fast-image/dist/index.test.d.ts.map
node_modules/react-native-fast-image/ios

@trickeyd
Copy link

So what is the situation with this PR?

It seems that with the sheer quantity of issues concerning memory management with this lib, this is a quick win for those attempting to manage it manually, no?

@mhdSid
Copy link

mhdSid commented Aug 26, 2021

I'll try to create a PR which contains the newly updated docs

@trickeyd
Copy link

@mhdSid Done it here
#818

Sorry didn't make into a PR earlier as I've been testing it

Copy link
Owner

@DylanVann DylanVann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@DylanVann DylanVann merged commit 818ed0c into DylanVann:master Sep 14, 2021
github-actions bot pushed a commit that referenced this pull request Sep 15, 2021
# [8.4.0](v8.3.7...v8.4.0) (2021-09-15)

### Bug Fixes

* export FastImageStaticProperties ([#822](#822)) ([d69f692](d69f692))
* update dv-scripts ([61fab12](61fab12))
* update dv-scripts ([3c6d0f4](3c6d0f4))

### Features

* add clear image cache from memory and disk ([#425](#425)) ([818ed0c](818ed0c))
@github-actions
Copy link

🎉 This PR is included in version 8.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@mhdSid
Copy link

mhdSid commented Sep 15, 2021

@pranav-jft
Copy link

https://github.com/DylanVann/react-native-fast-image#static-methods

Hello can anyone tell me how am I supposed to use it as simply calling FastImage.clearMemoryCache();
FastImage.clearDiskCache(); isn't showing any difference in xcode profiler

@fukemy
Copy link

fukemy commented Nov 8, 2022

love u all

@fukemy
Copy link

fukemy commented Nov 8, 2022

@pranav-jft, u can call this method everytime app open, in useEffect of App.js...

@vineethvijayan314
Copy link

Is it possible to clear images with a TTL(Time to Live) like 10 days or something?

alicayan008 pushed a commit to alicayan008/ReactNative-fast-image that referenced this pull request Jul 4, 2023
# [8.4.0](DylanVann/react-native-fast-image@v8.3.7...v8.4.0) (2021-09-15)

### Bug Fixes

* export FastImageStaticProperties ([#822](DylanVann/react-native-fast-image#822)) ([d69f692](DylanVann/react-native-fast-image@d69f692))
* update dv-scripts ([61fab12](DylanVann/react-native-fast-image@61fab12))
* update dv-scripts ([3c6d0f4](DylanVann/react-native-fast-image@3c6d0f4))

### Features

* add clear image cache from memory and disk ([#425](DylanVann/react-native-fast-image#425)) ([818ed0c](DylanVann/react-native-fast-image@818ed0c))
tungxuan1656 pushed a commit to tungxuan1656/react-native-fast-image that referenced this pull request Dec 26, 2023
# [8.4.0](DylanVann/react-native-fast-image@v8.3.7...v8.4.0) (2021-09-15)

### Bug Fixes

* export FastImageStaticProperties ([DylanVann#822](DylanVann#822)) ([d69f692](DylanVann@d69f692))
* update dv-scripts ([61fab12](DylanVann@61fab12))
* update dv-scripts ([3c6d0f4](DylanVann@3c6d0f4))

### Features

* add clear image cache from memory and disk ([DylanVann#425](DylanVann#425)) ([818ed0c](DylanVann@818ed0c))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet