I am using using laravel and Redis driver to store my cache and I keep my keys scoped to the current tenant. Below is how I set my cache; where $tenant is the current tenant.
$department_count = Cache::remember('dep_count:'.$tenant, 60 * 60 * 24, function () use ($tenant) {
return Department::where('is_active', 'yes')->where('tenantID', $tenant)->count();
});
So on switch school, I want to clear all the cache for current tenant using cache::forget() but I don't know how to do that.
I've tried Cache::forget('*:'.$tenant) but it doesn't seem to work. Any help on how to go about it is much appreciated.