Tuesday, 11 February 2025

Laravel Cache on Redis

Deleting laravel cache when redis is applied



Assuming the Laravel cache used redis
$roles = Cache::store('redis')->rememberForever(
"roles-123456",
function () {
return Role::where('team_id', 12345)
->
get();
}
);


Cache can only be cleared by


Cache::store('redis')->forget("roles-123456");




Share:

0 comments:

Post a Comment

Popular Posts

Recent Posts

Pages

Powered by Blogger.

About Me

My photo
For the past 10 years, I've been playing with codes using PHP, Java, Rails. I do this for a living and love new things to learn and the challenges that comes with it. Besides programming I love spending time with friends and family and can often be found together catching the latest movie or planning a trip to someplace I've never been before.