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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question - Where in the code does caching occur? #15

Closed
alfonsogarza opened this issue Apr 24, 2022 · 2 comments
Closed

Question - Where in the code does caching occur? #15

alfonsogarza opened this issue Apr 24, 2022 · 2 comments

Comments

@alfonsogarza
Copy link

First off, amazing work! Thanks 馃檹

I was debugging an issue I have with images no caching correctly (likely due to size or cookies?) and it got me going through the code.

Could you point me to where the caching occurs? I only see one storeCachedResponse that in my case never gets triggered because there aren't any redirects.

Does the session automatically do it in this line: let (data, _, metrics) = try await session.data(for: request)? I was under the likely incorrect impression we had to explicitly call storeCachedResponse.

@lorenzofiamingo
Copy link
Owner

Does the session automatically do it in this line: let (data, _, metrics) = try await session.data(for: request)?

Exactly.

Try removing metrics.redirectCount > 0 from row 356, and, if you want, tell me if this solves your issue.

@denis-obukhov
Copy link

denis-obukhov commented Mar 8, 2023

I've tried to remove metrics.redirectCount > 0 and it started entering this section of the code. But it still actually loads an image on appear. I mean, it shows the image, but at the same time makes a network request and downloads an image.
Maybe add something like


if case .success(_) = phase { return }

within load()
With such a piece of code and with metrics.redirectCount > 0 removed it became working as expected

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

No branches or pull requests

3 participants