Skip to content

Instantly share code, notes, and snippets.

@sryabov
Forked from K-Phoen/config.yml
Last active October 18, 2016 15:11
Show Gist options
  • Save sryabov/5e06c3dcb73c6eb6b4908e7e13cbdd02 to your computer and use it in GitHub Desktop.
Save sryabov/5e06c3dcb73c6eb6b4908e7e13cbdd02 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
aptitude install memcached php5-memcached
parameters:
# ...
session_memcached_host: localhost
session_memcached_port: 11211
session_memcached_prefix: sess
session_memcached_expire: 3600
services:
session.memcached:
class: Memcached
arguments:
persistent_id: %session_memcached_prefix%
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