›
›
›
  1. docs
  2. ›
  3. byrcsc/laravel-whitelabel
1.x
Browse documentationOpenClose

Getting started

  • Introduction
  • Installation and setup
  • Quick start

Core concepts

  • Brand definitions
  • Fallback and clearing
  • Brand resolution
  • Brand repositories

Using brands

  • Blade components
  • Mail and notifications
  • Queues
  • Spatie Multitenancy

Operations

  • Manage database brands
  • Custom drivers and resolvers
  • Events and listeners
  • Cache management

Reference

  • Configuration
  • Public API
  • Console commands
  • Testing
  • Troubleshooting

Getting started

  • Introduction
  • Installation and setup
  • Quick start

Core concepts

  • Brand definitions
  • Fallback and clearing
  • Brand resolution
  • Brand repositories

Using brands

  • Blade components
  • Mail and notifications
  • Queues
  • Spatie Multitenancy

Operations

  • Manage database brands
  • Custom drivers and resolvers
  • Events and listeners
  • Cache management

Reference

  • Configuration
  • Public API
  • Console commands
  • Testing
  • Troubleshooting

byrcsc/laravel-whitelabel · 1.x

Cache management.

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.

Configure the cache

'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.

Understand stored entries

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.

Clear package cache entries

php artisan whitelabel:clear

The 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.

Use tenant cache prefixes

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.

What to read next

  • Console commands for exact clear-command behavior.
  • Spatie Multitenancy for tenant switching and cache safety.
  • Troubleshooting when a lookup appears stale.
PreviousEvents and listenersNextConfiguration
View source

On this page

  1. Configure the cache
  2. Understand stored entries
  3. Clear package cache entries
  4. Use tenant cache prefixes
  5. What to read next