Because gears don’t share memory, the only way to handle sessions in a scalable application is to use a database. Or, you can use memcached which is simple enough to do but it will consume another gear in a scalable application.
Using the “rhc” command, we can add the memcahced cartridge to the application (in this case) TestApp.
rhc cartridge add http://cartreflect-claytondev.rhcloud.com/reflect?github=dimsum12/openshift-origin-cartridge-memcached --app TestApp
The two environment variable that you might be interested in are:
OPENSHIFT_MEMCACHED_HOST The Memcached IP address OPENSHIFT_MEMCACHED_PORT The Memcached port