mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-04 19:24:02 +00:00
Add note about phpredis
This commit is contained in:
parent
03ee52e62a
commit
998f065338
5 changed files with 8 additions and 5 deletions
|
|
@ -20,7 +20,6 @@ You won't have to change a thing in your application's code.\*
|
|||
### Requirements
|
||||
|
||||
- Laravel 5.7 or 5.8
|
||||
- phpredis (predis is not supported)
|
||||
|
||||
### Installing the package
|
||||
|
||||
|
|
@ -97,6 +96,8 @@ config('tenancy.redis.prefix_base') . $uuid
|
|||
|
||||
These changes will only apply for connections listed in `prefixed_connections`.
|
||||
|
||||
> **Note: *If you want Redis to be multi-tenant, you <u>must</u> use phpredis. Predis does not support prefixes.***
|
||||
|
||||
#### `cache`
|
||||
|
||||
Cache keys will be tagged with a tag:
|
||||
|
|
@ -326,7 +327,7 @@ The entire application will use a new database connection. The connection will b
|
|||
|
||||
Connections listed in the `tenancy.redis.prefixed_connections` config array use a prefix based on the `tenancy.redis.prefix_base` and the tenant UUID.
|
||||
|
||||
**Note: You *must* use phpredis. Predis doesn't support prefixes.**
|
||||
**Note: You *must* use phpredis if you want mutli-tenant Redis. Predis doesn't support prefixes.**
|
||||
|
||||
## Cache
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ trait BootstrapsTenancy
|
|||
public function bootstrap()
|
||||
{
|
||||
$this->switchDatabaseConnection();
|
||||
if ($this->app['config']['tenancy.redis.multitenant']) {
|
||||
if ($this->app['config']['tenancy.redis.tenancy']) {
|
||||
$this->setPhpRedisPrefix($this->app['config']['tenancy.redis.prefixed_connections']);
|
||||
}
|
||||
$this->tagCache();
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ return [
|
|||
'suffix' => '',
|
||||
],
|
||||
'redis' => [
|
||||
'multitenant' => true,
|
||||
'tenancy' => false,
|
||||
'prefix_base' => 'tenant',
|
||||
'prefixed_connections' => [
|
||||
'default',
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class BootstrapsTenancyTest extends TestCase
|
|||
{
|
||||
Config::set('database.redis.client', 'predis');
|
||||
Redis::setDriver('predis');
|
||||
Config::set('tenancy.redis.multitenant', false);
|
||||
Config::set('tenancy.redis.tenancy', false);
|
||||
|
||||
// assert no exception is thrown from initializing tenancy
|
||||
$this->assertNotNull($this->initTenancy());
|
||||
|
|
@ -48,6 +48,7 @@ class BootstrapsTenancyTest extends TestCase
|
|||
{
|
||||
Config::set('database.redis.client', 'predis');
|
||||
Redis::setDriver('predis');
|
||||
Config::set('tenancy.redis.tenancy', true);
|
||||
|
||||
$this->expectException(PhpRedisNotInstalledException::class);
|
||||
$this->initTenancy();
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
|
|||
'public',
|
||||
's3',
|
||||
],
|
||||
'tenancy.redis.tenancy' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue