Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache Problem #972

Open
KatiaSishost opened this issue Jan 11, 2021 · 0 comments
Open

Cache Problem #972

KatiaSishost opened this issue Jan 11, 2021 · 0 comments

Comments

@KatiaSishost
Copy link

Helloo! im having problem with a cache..

see, i create a CacheServiceProvider with php artisan make:provider CacheServiceProvider...

in boot()

{
    Cache::extend('redis_tenancy', function ($app) {
        if (PHP_SAPI === 'cli') {
            $uuid = $app['config']['driver'];
        } else {
            // ok, this is basically a hack to set the redis cache store
            // prefix to the UUID of the current website being called
            $fqdn = request()->getHost();

            $uuid = DB::table('hostnames')
                ->select('websites.uuid')
                ->join('websites', 'hostnames.website_id', '=', 'websites.id')
                ->where('fqdn', $fqdn)
              
```  ->value('uuid');
        }

        return Cache::repository(new RedisStore(
            $app['redis'],
            $uuid,
            $app['config']['cache.stores.redis.connection']
        ));
    });
}
in config/cache.php edit the redis to

'redis' => [
'driver' => 'redis_tenancy',
'connection' => 'default',
],

the problem for example is... if i put manually 1 tenant in maintenance mode in database... i need delete cache to refresh and see the tenant 2 for example in maintenance mode... and delete the date in database and clean again
to see online the tenant again.

else i use the comand tenancy:down -tenant=2... all tenants are offline..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant