views:

141

answers:

1

I have 2 Symfony applications (1 using 1.2.x, another using 1.4.x and both using Propel) that need to share some specific session information. Although I have no experience with memcached, my sense--after some reading--is that it may be able to serve as an external (FAST) repository that each app could read and write to. Unfortunately, I can't find much information about how to use it with Symfony in any capacity, much less in the quasi-cache, quasi-messaging server I'm envisioning.

My questions, I suppose, are:

  • Am I mistaken in believing that memcached be used in this manner and access by multiple systems?
  • How can I configure Symfony to access a memcached repository?

Thanks.

A: 

This explains one approach fairly well (you don't need the view cache stuff, just the second half about making a singleton available and configuring it):

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

You can then use:

sfMemcache::getInstance()->set()

and

sfMemcache::getInstance()->get()

(same as the methods at http://php.net/memcache as sfMemcache subclasses Memcache).

As long as both apps point to the same memcache, you should be able to share data between them like this.

benlumley
Thanks, Ben. I hadn't seen this article, but this is the direction I took on my own sans extending the `sfMemcache` class that I didn't know existed. This solution seems to tighten things up nicely, so I'm going to move in this direction.
Rob Wilkerson