CRedisCache HTTP Session Store

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 -

‘cache’ => 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.




there are works doing the same thing as you : yiiRedis

you can find more component beyond the RedisSession

and also look at this one redisCache

Cool, good stuff. All I really wanted was a way to provide a separate redis DB for the sake of isolating the Session store (handy when running cache->flushdb() and not wanting to loose the current session store).