mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 05:44:04 +00:00
Allow suffix for prefixed Redis connections
This will allow suffixing Redis tenant connections with a configured suffix or default to `_` for better readability.
This commit is contained in:
parent
8db27a358e
commit
d198baf55c
1 changed files with 2 additions and 1 deletions
|
|
@ -26,10 +26,11 @@ class RedisTenancyBootstrapper implements TenancyBootstrapper
|
|||
{
|
||||
foreach ($this->prefixedConnections() as $connection) {
|
||||
$prefix = $this->config['tenancy.redis.prefix_base'] . $tenant->getTenantKey();
|
||||
$suffix = $this->config['tenancy.redis.suffix'] ?? '_';
|
||||
$client = Redis::connection($connection)->client();
|
||||
|
||||
$this->originalPrefixes[$connection] = $client->getOption($client::OPT_PREFIX);
|
||||
$client->setOption($client::OPT_PREFIX, $prefix);
|
||||
$client->setOption($client::OPT_PREFIX, $prefix.$suffix);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue