Symfony2/Memcached integration

核能气质少年 提交于 2019-12-03 16:52:09

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/11540171/symfony2-memcached-integration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!