PHP and Memcached Returning Random Data
This took a long time to track down and only applies in specific circumstances:
- Your process is forking
- You are using persistent memcache connections
- The data you request does not match what you receive, for instance you expect an array and an integer is returned.
The problem is caused by the persistent connection being shared after the process has forked. This is a known issue on database connections which is why you should always stop and restart your database connections after a process forks however this is not a documented ‘feature’ of the memcache connections. Trying to close and reopen the memcache connections doesn’t help either.… Read the rest