1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 03:14:04 +00:00

Add comments [ci skip]

This commit is contained in:
Samuel Štancl 2019-04-24 16:53:32 +02:00
parent e9786cbfc0
commit e45984100e

View file

@ -71,10 +71,12 @@ class RedisStorageDriver implements StorageDriver
return "tenants:{$hash}"; return "tenants:{$hash}";
}, $uuids); }, $uuids);
// Apparently, the PREFIX is applied to all functions except scan()
$redis_prefix = $this->redis->getOption($this->redis->client()::OPT_PREFIX); $redis_prefix = $this->redis->getOption($this->redis->client()::OPT_PREFIX);
$hashes = $hashes ?: $this->redis->scan(null, $redis_prefix.'tenants:*'); $hashes = $hashes ?: $this->redis->scan(null, $redis_prefix.'tenants:*');
return array_map(function ($tenant) use ($redis_prefix) { return array_map(function ($tenant) use ($redis_prefix) {
// Left strip $redis_prefix from $tenant
if (substr($tenant, 0, strlen($redis_prefix)) == $redis_prefix) { if (substr($tenant, 0, strlen($redis_prefix)) == $redis_prefix) {
$tenant = substr($tenant, strlen($redis_prefix)); $tenant = substr($tenant, strlen($redis_prefix));
} }