php sessions and memcache

Andy memcached at
Tue Jul 18 04:18:57 UTC 2006

On Mon, 2006-07-17 at 21:21 -0500, Richard Thomas wrote:
> The race condition comes from the locking of tables on multiple updates 
> to the table at the same time.
> There are a couple ways to help prevent that
> 1. I hash during the read and check the hash during the write, If the 
> hash has not changed I only update the expire time not the whole session
> 2. I only update the expire time every X seconds, this way if there are 
> no changes to the session and its only been a few seconds I don't waste 
> resources updating
> 3. When I do update just the expire time I do it low priority

Uh, at this point, I think we're talking about different things, so

> Andy wrote:
> > It was actually written to see if session updating race conditions could
> > be avoided when, using Ajax, multiple interleaved code paths run
> > against, and update, the same session.

The race condition I'm referring to, and that I had solved for, is
mentioned at

which transcends the storage backend used.

Andy <memcached at>

More information about the memcached mailing list