Configure Symfony for use with Memcached

I have 2 Symfony applications (1 using 1.2.x, the other using 1.4.x and both using Propel) that need to share certain session information. Although I have no experience with memcached, my point - after some reading - is that it can serve as an external (FAST) repository that every application can read and write. Unfortunately, I cannot find much information on how to use it with Symfony in any capacity, and even more so in the quasi-cache, the quasi-messaging server that I foresee.

My questions are, I suppose, the following:

  • Am I mistaken in believing that memcached can be used this way and accessed by multiple systems?
  • How to configure symfony to access memcached repository?

Thanks.

+4
source share
1 answer

This explains one approach quite well (you don't need things in the presentation cache, only the second half is about making one single available and setting it up):

http://dev.esl.eu/blog/2009/06/05/memcached-as-singleton-in-symfony/

edit: now 404 but still available here

Then you can use:

 sfMemcache::getInstance()->set() 

and

 sfMemcache::getInstance()->get() 

(same as methods here as subclasses of sfMemcache Memcache).

As long as both applications point to the same memcache, you should be able to exchange data between them as follows.

+3
source

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


All Articles