mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 03:34:03 +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) {
|
foreach ($this->prefixedConnections() as $connection) {
|
||||||
$prefix = $this->config['tenancy.redis.prefix_base'] . $tenant->getTenantKey();
|
$prefix = $this->config['tenancy.redis.prefix_base'] . $tenant->getTenantKey();
|
||||||
|
$suffix = $this->config['tenancy.redis.suffix'] ?? '_';
|
||||||
$client = Redis::connection($connection)->client();
|
$client = Redis::connection($connection)->client();
|
||||||
|
|
||||||
$this->originalPrefixes[$connection] = $client->getOption($client::OPT_PREFIX);
|
$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