Code to store PHP sessions within memcached.
memcached at thwartedefforts.org
Fri Nov 17 18:29:31 UTC 2006
On Fri, 2006-11-17 at 10:32 -0300, Mauro N. Infantino wrote:
> Keep in mind that the standard php session module locks the whole session
> until the request finishes (or the user calls session_write_close) .
> I could send the code implementing locking using memcache's add
> method, if you want.
>  Take a look at
> Under "Observing the Race Condition". Also, there are some code examples.
Cool, I get a mention someplace else. :) I was going to include an
example memcached handler in the demo app, but ran out of time to finish
writing it. I'd love to see what you've got. I was thinking that
mutual exclusion would be implemented by creating a semaphore using
memcached's atomic incr/decr operations, but polling for changes became
difficult to handle. If memcached supported a "wait upto X seconds for
a key to be changed" operation or something like that, using memcached
as a generic distributed lock manager (although hardly fault tolerant)
might be easier (ahem, not to suggest that memcached should be used for
SOMETHING ELSE that it wasn't intended for :) ).
Andy <memcached at thwartedefforts.org>
More information about the memcached