Skip to content

[V5˖] Configuring a fallback driver

Georges.L edited this page Feb 20, 2020 · 3 revisions

⚠️ Please note that this feature has been removed as of the V8

⚠️ It's been replaced by aggregated cluster support, see migration guide


In some case you want to be sure that a fallback cache is available if the main one fails for some reasons. The code is pretty simple:

$InstanceCache = CacheManager::getInstance('redis', [
  'fallback' => 'Files', 
  'path' => 'path/to/write/files/to'
]);

❗ Until the V7 the fallback does not support the override of configuration. Therefore you cannot put Ssdb as a fallback of Redis due to the conflict of the following options:

  • port
  • host
  • password

As of the V7 this will ensure you a completely independant fallback configuration:

$InstanceCache = CacheManager::getInstance('redis', new ConfigurationOption([
  'fallback' => 'Files', 
  'fallback_config' => new ConfigurationOption(/* ... */), 
  'path' => 'path/to/write/files/to'
]));

But Files will work (please note that as of the V6.1 the path configuration can be conflicting).

‼️ When the fallback is configured and is triggered an E_USER_WARNING error will be raised to alert you that your project is running in degraded mode.

Clone this wiki locally