i want to use a cache of laravel for ex: index method on a specific controllers! i use Cache::rememberForever method of laravel cache.
i dont use Cache::remember with ttl time for caching data!
my question: i dont no when and how i update data in cache
imaging: i cached user profile with all relations! now user change avatar or personal data! now i should be renew (update) cache data in redis! (update cache data for get in next call) i want to know the best solution for updating cache data when update main data
To update a cache you can use such. event function in your User model:
Next time you call
Cache::rememberForever()will not find this entity by key and will make it on the fly