Quantcast
Channel: How to tell doctrine to ignore Memcached if server is offline? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

How to tell doctrine to ignore Memcached if server is offline?

0
0

I'm testing Memcached on my Symfony2 application I set it to cache doctrine's queries, results and metadata:

orm:
    entity_managers:
        default:
            metadata_cache_driver:
                type: service
                id: doctrine.cache.memcache2
            query_cache_driver:
                type: service
                id: doctrine.cache.memcache2
            result_cache_driver:
                type: service
                id: doctrine.cache.memcache2

services:
    memcache:
        class: Memcache
        calls:
            - [ addserver, [ 'localhost', 11211 ]]

    doctrine.cache.memcache2:
        class: Doctrine\Common\Cache\MemcacheCache
        calls:
            - [setMemcache, [@memcache]]

Until now, everything works fine.

I was wondering how does doctrine behaves if the Memcached server goes down. As far as I could see, the application breaks. In dev mode I get the following message:

Notice: MemcachePool::get(): Server localhost (tcp 11211, udp 0) failed with: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (10060) 500 Internal Server Error - ContextErrorException

In production mode I'm also presented with an http 500.

Is there a way to tell doctrine to bypass/ignore the Memcached server and go directly to the database, instead of returning 500s?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images