renoki-co/laravel-eloquent-query-cache

Invalidating specific user cache

fresent opened this issue · 1 comments

We want to cache User table and are using cache at table level with a TTL of 5 minutes.

We use dontCache in our UI queries to reflect the change to user immediately.

However, we are in a bind on how we achieve same thing when call to user table is made via auth()->user().

We don't want to invalidate/refresh cache for whole users table, but rather for only one user.

Since, the get method are part of laravel package, and we don't want to touch that for user(), only thing that comes to our mind is to invalidate cache for user, when update is done to that user's entry in user table.

Any guidance on how to do that?