In Ruby, you can store your data in any datastore. Not sure if you can use the built-in session API to store to Redis AND memcached for the same session.
If you manually access Redis, just connect to it as few times as possible and use persistent connections, if appropriate, to improve performance.
For PHP and other server-side scripting languages, you might not want to use the built-in session management. Many server-side scripting languages (i.e. PHP) store session information in a temporary directory on the hard disk. Only the session ID is stored in a cookie. An advantage of Redis and memcached is they can avoid disk access and store all session/user information in memory. So, rather than using the built-in session API, just write your own little session API using cookies and interacting with Redis or memcached.