Search code examples
phpsessionherokumemcachedmemcachier

Heroku and Memcachier (Memcached) Logging Users Out (PHP)


I'm running a PHP application on Heroku and handling sessions using Memcachier add-on.

What Works: - Memcachier successfully keeps users logged in through new deployments to Heroku.

What Doesn't Work - Users will get logged out randomly throughout their time in the web application.

How do I get the user sessions to stay logged in (until the user logs out - or some other automatic login policy we put in place)?


Solution

  • Memcache is not recommended for storing sessions as it is a cache and not a persistant cache. What this means is that any key/value pair can get pushed out by new pairs if the cache is full. To get session persistance either switch to a different memcache server (with persistance) or store you sessions differently (eg: in a database)