Welcome Guest, Not a member yet? Register   Sign In
Display a custom error if the cache driver fails

What would be the best way to display a custom error message when the cache driver fails (Memcached in my case)?

I thought of creating a FILTER, and within this filter testing the ->getCacheInfo() method. Does this seem correct?

Like this:

PHP Code:
public array $aliases = [
        'csrf'          => CSRF::class,
        'toolbar'      => DebugToolbar::class,
        'honeypot'      => Honeypot::class,
        'invalidchars'  => InvalidChars::class,
        'secureheaders' => SecureHeaders::class,
        'authentication' => AuthenticationFilter::class,
b]        'verifyCache'  => VerifyMemcachedFilter::class,
b]    ];
public array 
$globals = [
        'before' => [


PHP Code:
    public function before(RequestInterface $request$arguments null)
        $cache Services::cache();
        if ($cache->getCacheInfo() === null) {
            echo 'MEMCACHED not started';

Theme © iAndrew 2016 - Forum software by © MyBB