-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation on how caching is handled.
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# How is caching handled? | ||
|
||
In the readme it says "Aggressively cache images.". What does this mean? | ||
|
||
This library treats image urls as immutable. | ||
That means it assumes the data located at a given url will not change. | ||
This is ideal for performance. | ||
|
||
The way this would work in practice for something like a user profile picture is: | ||
|
||
- Request user from API. | ||
- Receive JSON representing the user containing a `profilePicture` property that is the url of the profile picture. | ||
- Display the profile picture. | ||
|
||
So what happens if the user wants to change their profile picture? | ||
|
||
- User uploads a new profile picture, it gets a new url on the backend. | ||
- Update a field in a database. | ||
|
||
Next time the app is opened: | ||
|
||
- Display the cached profile picture immediately. | ||
- Request the user json again (this time it will have the new profile picture url). | ||
- Display the new profile picture. |