How to use memcache with symfony

I am using symfony 2 and I want to use Memcache, but the problem is that I cannot find any explanation for Memcache that I just found for memcached, same as the same setup steps? I added these lines to install Memcache on symfony?

config.yml

framework:
  session:
    handler_id: session.handler.memcached

for .yml options

parameters:   
  memcached_host: 127.0.0.1
  memcached_port: 11211
  memcached_prefix: custom_key_
  memcached_expire: 14400

services.yml

services:
  session.handler.memcached:
    class: Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler
    arguments: [ "@session.memcached", { prefix: '%memcached_prefix%', expiretime: '%memcached_expire%' } ]


services:
  session.memcached:
    class: Memcached
    arguments:
      persistent_id: %memcached_prefix%
    calls:
      - [ addServer, [ %memcached_host%, %memcached_port% ]]



services:
  session.memcached:
    class: Madisoft\AppBundle\Utils\MemcachedWrapper
    arguments:
      persistent_id: '%memcached_prefix%'
    calls:
      - [ addServer, [ '%memcached_host%', '%memcached_port%' ] ]
+4
source share
1 answer

There is only one Memcachedsoftware, and it is available at https://memcached.org/ .

PHP Memcached, memcache (http://php.net/manual/en/book.memcache.php) Memcached (http://php.net/manual/en/book.memcached.php), , , - .

Memcached Symfony 2, LeaseWeb, : https://github.com/LeaseWeb/LswMemcacheBundle.

Symfony 3.3 Memcached: . http://symfony.com/blog/new-in-symfony-3-3-memcached-cache-adapter.

+6

Source: https://habr.com/ru/post/1673182/


All Articles