Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony2/Memcached integration

I was following a blog post (link no longer available) and added memcached to services.yml

parameters:
    memcached.servers:
      - { host: 127.0.0.1, port: 11211 }

services:
    memcached:
        class: Memcached
        calls:
            - [ addServers, [ %memcached.servers% ]]

Then in my controller:

$memcached = $this->get('memcached');

Looks very pretty. If I can get past 500 - You have requested a non-existent service "memcached"!

The test code from php connects to memcached without any troubles. Done cache:clear, cleared cache manually - doesn't help.

Where should I look?

like image 291
Leo Avatar asked Jul 18 '12 11:07

Leo


1 Answers

Adrien was right in his comments - services.yml file isn't used by default. You have to explicitly include it in config.yml

like image 137
Leo Avatar answered Oct 16 '22 19:10

Leo