Skip to content

Instantly share code, notes, and snippets.

@wdalmut
Forked from K-Phoen/config.yml
Created January 24, 2018 13:47
Show Gist options
  • Save wdalmut/086494931d5b34f896838959ff79d02a to your computer and use it in GitHub Desktop.
Save wdalmut/086494931d5b34f896838959ff79d02a to your computer and use it in GitHub Desktop.
Storing Symfony2 sessions in memcached
imports:
# ....
- { resource: services/session.yml }
framework:
# ....
session:
handler_id: session.handler.memcached
parameters:
# ...
session_memcached_host: localhost
session_memcached_port: 11211
session_memcached_prefix: sess
session_memcached_expire: 3600
services:
session.memcached:
class: Memcached
calls:
- [ addServer, [ %session_memcached_host%, %session_memcached_port% ]]
session.handler.memcached:
class: Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler
arguments: [@session.memcached, { prefix: %session_memcached_prefix%, expiretime: %session_memcached_expire% }]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment