What if scenario: PatientId =100, LoggedOnUser = 1, LoggedOnUser = 2.
Josh Yates

The best way to think about this is that each row in a database is cached. Both logged on users are viewing a single patient, but the cache key is only associated with the row of the patient and not the logged in user. So regardless of who updates the patient when the next user tries to get the patient it will pull new data.

The more confusing part is when you have a collection of patients. But in this scenario, the collection is a cache of the the ids that it represents and then you loop through the ids and grab the rows.

So if a patient is updated, we only need to update the single row that was cached, the collection doesn’t care. If we delete a patient the collection doesn’t care either because it won’t find the cached result and it’ll skip it. if a patient is added, then the collection will need to be uncached.