I know it is bad practice to store session data in cache, however given Redis’s disk storage I think it might be a viable option for Session data storing in production environments.
This is a little extension off of CCacheHttpSession which assumes an installation of CRedisCache as the Cache component, and taps into that to store all session data in a user-configured Redis DB, with the intention of being separate from the production cache DB’s.
Let me know fixes, bugs, better-ways-to-do-things, anything really.
Extract into extensions, configure as such in your components to connect to 127.0.0.1:6379 -
‘cache’ => array(
'class'=>'ext.redis.CRedisCache',
'servers'=>array(
'database'=>0,
),
),
‘session’=>array(
'class' => 'ext.PRedisCacheHttpSession.PRedisCacheHttpSession',
'database' => 9, //This should be different from your cache redis DB, or indeed any other redis DB currently in use.
),
Link: github.com/lincsanders/PRedisCacheHttpSession
/Lincoln