Skip to content

Commit 8aa6c6b

Browse files
committed
Add documentation on how caching is handled.
1 parent a78950d commit 8aa6c6b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/how-is-caching-handled.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# How is caching handled?
2+
3+
In the readme it says "Aggressively cache images.". What does this mean?
4+
5+
This library treats image urls as immutable.
6+
That means it assumes the data located at a given url will not change.
7+
This is ideal for performance.
8+
9+
The way this would work in practice for something like a user profile picture is:
10+
11+
- Request user from API.
12+
- Receive JSON representing the user containing a `profilePicture` property that is the url of the profile picture.
13+
- Display the profile picture.
14+
15+
So what happens if the user wants to change their profile picture?
16+
17+
- User uploads a new profile picture, it gets a new url on the backend.
18+
- Update a field in a database.
19+
20+
Next time the app is opened:
21+
22+
- Display the cached profile picture immediately.
23+
- Request the user json again (this time it will have the new profile picture url).
24+
- Display the new profile picture.

0 commit comments

Comments
 (0)