Created
          December 18, 2012 11:22 
        
      - 
      
 - 
        
Save K-Phoen/4327229 to your computer and use it in GitHub Desktop.  
    Storing Symfony2 sessions in memcached
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | imports: | |
| # .... | |
| - { resource: services/session.yml } | |
| framework: | |
| # .... | |
| session: | |
| handler_id: session.handler.memcached | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | aptitude install memcached php5-memcached | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | parameters: | |
| # ... | |
| session_memcached_host: localhost | |
| session_memcached_port: 11211 | |
| session_memcached_prefix: sess | |
| session_memcached_expire: 3600 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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
  
            
https://gist.github.com/elmariachi111/5637669a028c29e3973a better late than never ;)
see: http://php.net/manual/en/memcached.construct.php#93536