Skip to content
This repository has been archived by the owner on Jul 6, 2020. It is now read-only.

can use one cache for multi instance on multi pages? #140

Open
develowper opened this issue Jan 14, 2020 · 5 comments
Open

can use one cache for multi instance on multi pages? #140

develowper opened this issue Jan 14, 2020 · 5 comments
Labels

Comments

@develowper
Copy link

develowper commented Jan 14, 2020

hello . i am using two networkimage in two page . image urls in two pages are the same. but every one cache image in its first time. means image caches two times in two directory (i think).
can i use one cache for this two widget?

@mchome
Copy link
Owner

mchome commented Jan 14, 2020

@override
bool operator ==(dynamic other) {
if (other.runtimeType != runtimeType) return false;
final AdvancedNetworkImage typedOther = other;
return url == typedOther.url &&
scale == typedOther.scale &&
useDiskCache == typedOther.useDiskCache &&
retryLimit == typedOther.retryLimit &&
retryDurationFactor == typedOther.retryDurationFactor &&
retryDuration == typedOther.retryDuration;
}

If the equal expression is true, they will be treated as the same in memory cache.
If the urls are the same, they will be treated as the same in disk cache.

@develowper
Copy link
Author

ok . thanks . and how i can check hashes are equal? how hashes are created? with file name or else?

@develowper
Copy link
Author

and can i cancel fetching url on dispose page? or is done automatically?

@mchome
Copy link
Owner

mchome commented Jan 14, 2020

ok . thanks . and how i can check hashes are equal? how hashes are created? with file name or else?

See the reference code above.

and can i cancel fetching url on dispose page? or is done automatically?

No, it will keep fetching until the response was received.

@develowper
Copy link
Author

No, it will keep fetching until the response was received.

unfortunately this slows down downloading images. a user may dispose image containing page and goes to another page with image. but last image is downloading and slows down network and performance. is not true?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants