›
byrcsc/laravel-whitelabel · 1.x
Configure and clear cached definitions for database and custom drivers.
Caching prevents repeated brand and domain lookups from reading the database or another data source. The package wraps every non-config driver with a cache by default and invalidates entries after repository writes.
'cache' => [
'enabled' => true,
'store' => null,
'prefix' => 'whitelabel',
],A null store uses Laravel's default cache store. The prefix scopes package keys, but it does not act as a tenant boundary unless the cache store itself is tenant-prefixed.
Set enabled to false for an already-cached custom driver or when every read
must reach the database:
'cache' => [
'enabled' => false,
'store' => null,
'prefix' => 'whitelabel',
],The config driver is never wrapped, regardless of this setting.
The decorator caches each brand's own definition forever. It does not cache the result after fallback values are applied. Changes to the default brand therefore appear in inherited values on the next lookup.
Domain lookups use a separate domain-to-identifier index that grows as domains
are requested. Missing identifier lookups are not cached. all() bypasses the
cache and does not warm it.
Create, update, and delete operations invalidate the affected identifier and the domain index. A default-brand write also clears the remembered fallback.
php artisan whitelabel:clearThe command removes package keys from the configured store and calls the inner
repository's flush(). It does not call Cache::flush(), so unrelated
application keys remain.
With the config driver or caching disabled, the command succeeds and reports that there was nothing to clear.
When Spatie's PrefixCacheTask switches cache prefixes, the repository follows
because it resolves the store on every call.
Keep whitelabel.cache.store null unless a named store receives the same tenant
prefix. Selecting an unprefixed store would bypass the tenant isolation.