Transcript
00:00 I'm going to log in as one of these other users so we can take a look at an interesting use case that doesn't really happen a lot, but definitely could happen. We'll log in as this user, and now we'll go find that user in our database. We will delete this record. Let's say that maybe some admin deleted it or they deleted it in a different tab or something like that.
00:19 Now, if I refresh the page, I'm no longer logged in, that's exactly what we want. But the problem is that my session is still active. There's still a user ID in here that isn't active in the database, and that is a problem because we're going to be making a request to the database unnecessarily because that user doesn't exist at all.
00:37 What would be better is if we found out, you had a user ID in your session, but that user doesn't exist in the database. There's something weird going on here, so let's just destroy that session so that we don't have to make those unnecessary requests to the database. That's the idea of what we're going to be
00:55 accomplishing in this exercise. Have a good time.