It would be good if we could have a fallback adapter (NullAdapter) in the case when some adapter fails to connect.
Ex. if Redis adapter throws ConnectionException and if the fallback option is set, no exception is thrown, but it will use NullAdapter.
Right now, if Redis is not available, app dies.
This could be achieved by adding some listeners directly in the app, and catch block, but if autowiring is used, it will fail.
I'm not expert on these libraries, but it looks like you can get very close to this behaviour already via the CachePoolChain.
In the $options constructor array you can pass a 'skip_on_failure' option. If true, this will cause Chain to capture the exceptions, remove the Pool causing them from the Chain and log a warning. If you add a VoidCachePool to the end of the chain it will be the only one left after the Redis pool fails, effectively giving you the behavior you want.
There is one tiny caveat to this solution: cache writes will be duplicated into the VoidCachePool as well... but the performance impact should be quite negligible.
It would be good if we could have a fallback adapter (NullAdapter) in the case when some adapter fails to connect.
Ex. if Redis adapter throws ConnectionException and if the fallback option is set, no exception is thrown, but it will use NullAdapter.
Right now, if Redis is not available, app dies.
This could be achieved by adding some listeners directly in the app, and catch block, but if autowiring is used, it will fail.
example config:
The text was updated successfully, but these errors were encountered: