Skip to content

Commit

Permalink
Add documentation on how caching is handled.
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanVann committed Jan 31, 2018
1 parent a78950d commit 8aa6c6b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/how-is-caching-handled.md
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.

0 comments on commit 8aa6c6b

Please sign in to comment.