Skip to content

Commit

Permalink
add redis as a valid option for global/session_save (#1513)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjocoleman authored May 12, 2021
1 parent 4d82a3c commit 4bfd347
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
8 changes: 3 additions & 5 deletions app/code/community/Cm/RedisSession/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</modules>
<global>
<models>
<core_mysql4>
<rewrite>
<session>Cm_RedisSession_Model_Session</session>
</rewrite>
</core_mysql4>
<cm_redissession>
<class>Cm_RedisSession_Model</class>
</cm_redissession>
</models>
</global>
</config>
5 changes: 5 additions & 0 deletions app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ public function start($sessionName = null)
$sessionResource = Mage::getResourceSingleton('core/session');
$sessionResource->setSaveHandler();
break;
case 'redis':
/* @var Cm_RedisSession_Model_Session $sessionResource */
$sessionResource = Mage::getSingleton('cm_redissession/session');
$sessionResource->setSaveHandler();
break;
case 'user':
// getSessionSavePath represents static function for custom session handler setup
call_user_func($this->getSessionSavePath());
Expand Down
4 changes: 2 additions & 2 deletions app/etc/local.xml.additional
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ to app/etc/local.xml manually.
-->
<config>
<global>
<session_save><![CDATA[]]></session_save> <!-- db / memcache / empty=files -->
<session_save><![CDATA[]]></session_save> <!-- db / memcache / redis / empty=files -->
<session_save_path><![CDATA[]]></session_save_path><!-- e.g. for memcache session save handler tcp://10.0.0.1:11211?persistent=1&weight=2&timeout=10&retry_interval=10 -->
<session_cache_limiter><![CDATA[]]></session_cache_limiter><!-- see http://php.net/manual/en/function.session-cache-limiter.php#82174 for possible values -->
<cache>
Expand Down Expand Up @@ -119,7 +119,7 @@ to app/etc/local.xml manually.
</full_page_cache>

<!-- example of redis session storage -->
<session_save>db</session_save>
<session_save>redis</session_save>
<redis_session> <!-- All options seen here are the defaults -->
<host>127.0.0.1</host> <!-- Specify an absolute path if using a unix socket -->
<port>6379</port>
Expand Down
2 changes: 1 addition & 1 deletion app/etc/modules/Cm_RedisSession.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<config>
<modules>
<Cm_RedisSession>
<active>false</active>
<active>true</active>
<codePool>community</codePool>
</Cm_RedisSession>
</modules>
Expand Down

0 comments on commit 4bfd347

Please sign in to comment.