TenantHostResolver
in package
Resolves request hostnames to platform tenant metadata.
Table of Contents
Constants
- CACHE_CONFIG : mixed = 'tenant_host_map'
- CACHE_KEY_PREFIX : mixed = 'tenant_host_map:'
Properties
- $cache : TenantAwareCache
- $connectionName : string
Methods
- __construct() : mixed
- clearCache() : bool
- Clear the shared tenant host map cache after platform tenant/host changes.
- normalizeHost() : string
- Normalize host names before platform lookup.
- resolve() : TenantMetadata|null
- Resolve a host to tenant metadata using active host mappings.
- cacheKey() : string
- Build the platform cache key for a datasource-specific host map.
- hostMap() : array<string, array<string, mixed>>
- Load active host mappings once for all users/processes.
- writeHostMapCache() : void
- Write the host map without letting cache backend/debug wrapper failures break requests.
Constants
CACHE_CONFIG
private
mixed
CACHE_CONFIG
= 'tenant_host_map'
CACHE_KEY_PREFIX
private
mixed
CACHE_KEY_PREFIX
= 'tenant_host_map:'
Properties
$cache read-only
private
TenantAwareCache
$cache
= new TenantAwareCache()
$connectionName read-only
private
string
$connectionName
= 'platform'
Methods
__construct()
public
__construct([string $connectionName = 'platform' ][, TenantAwareCache $cache = new TenantAwareCache() ]) : mixed
Parameters
- $connectionName : string = 'platform'
-
Platform datasource name
- $cache : TenantAwareCache = new TenantAwareCache()
clearCache()
Clear the shared tenant host map cache after platform tenant/host changes.
public
static clearCache([string $connectionName = 'platform' ]) : bool
Parameters
- $connectionName : string = 'platform'
-
Platform datasource name
Return values
boolnormalizeHost()
Normalize host names before platform lookup.
public
normalizeHost(string $host) : string
Parameters
- $host : string
-
Host name
Return values
stringresolve()
Resolve a host to tenant metadata using active host mappings.
public
resolve(string $host) : TenantMetadata|null
Parameters
- $host : string
-
Request host
Return values
TenantMetadata|nullcacheKey()
Build the platform cache key for a datasource-specific host map.
private
static cacheKey(string $connectionName) : string
Parameters
- $connectionName : string
-
Platform datasource name
Return values
stringhostMap()
Load active host mappings once for all users/processes.
private
hostMap() : array<string, array<string, mixed>>
Return values
array<string, array<string, mixed>>writeHostMapCache()
Write the host map without letting cache backend/debug wrapper failures break requests.
private
writeHostMapCache(string $cacheKey, array<string, array<string, mixed>> $map) : void
Parameters
- $cacheKey : string
-
Logical platform cache key
- $map : array<string, array<string, mixed>>
-
Host map