Download the PHP package colinmollenhour/magento-redis-session without Composer

On this page you can find all versions of the php package colinmollenhour/magento-redis-session. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package magento-redis-session

Cm_RedisSession

A Redis-based session handler for Magento with optimistic locking.

Features:

Locking Algorithm Properties:

Session Cookie Management:

The Cookie Lifetime is configured here (Magento default): System > Configuration > Web > Session Cookie Management > Cookie Lifetime. You can override the default session lifetime settings of this module by setting the <max_lifetime> and <min_lifetime> handle if you need to adjust your session lifetime settings. Be aware that if the <max_lifetime> setting is below your Cookie Lifetime, the <max_lifetime>-setting will be taken.

Installation

This extension can be installed with either Composer or modman.

Important: The 3.0.0 release is packaged exclusively as a composer module and cannot be installed with modman. If you do not use composer stick with the 2.x release.

The Magento Compiler feature is currently not supported.

Modman Installation

  1. Install module using modman:

    modman clone https://github.com/colinmollenhour/Cm_RedisSession

    If you want to install a specific version, you can add -- --branch x.y.z to the command.

  2. Configure via app/etc/local.xml adding a global/redis_session section with the appropriate configuration if needed. See the "Configuration Example" below.
  3. Refresh the config cache to allow the module to be installed by Magento.
  4. Test the configuration by running the migrateSessions.php script in --test mode.

    sudo php .modman/Cm_RedisSession/migrateSessions.php --test
  5. Change the global/session_save configuration to "db" in app/etc/local.xml. The "db" value is the MySQL handler, but Cm_RedisSession overrides it to avoid modifying core files.
  6. Migrate the old sessions to Redis. See the "Migration" section below for details. The migration script will clear the config cache after migration is complete to activate the config change made in step 5.

Configuration Example

Migration

A script is included to make session migration from files storage to Redis with minimal downtime very easy. Use a shell script like this for step 6 of the "Installation" section.

Depending on your server setup this may require some changes. Old sessions are not deleted so you can run it again if there are problems. The migrateSessions.php script has a --test mode which you definitely should use before the final migration. Also, the --test mode can be used to compare compression performance and ratios. Last but not least, the --test mode will tell you roughly how much space your compressed sessions will consume so you know roughly how to configure maxmemory if needed. All sessions have an expiration so volatile-lru or allkeys-lru are both good maxmemory-policy settings.

Compression

Session data compresses very well so using compression is a great way to increase your capacity without dedicating a ton of RAM to Redis and reducing network utilization. The default compression threshold is 2048 bytes so any session data equal to or larger than this size will be compressed with the chosen compression_lib which is gzip by default. Compression can be disabled by setting the compression_lib to none. However, both lzf and snappy offer much faster compression with comparable compression ratios so I definitely recommend using one of these if you have root. lzf is easy to install via pecl:

sudo pecl install lzf

NOTE: If using suhosin with session data encryption enabled (default is suhosin.session.encrypt=on), two things:

  1. You will probably get very poor compression ratios.
  2. Lzf fails to compress the encrypted data in my experience. No idea why...

If any compression lib fails to compress the session data an error will be logged in system.log and the session will still be saved without compression. If you have suhosin.session.encrypt=on I would either recommend disabling it (unless you are on a shared host since Magento does it's own session validation already) or disable compression or at least don't use lzf with encryption enabled.

Bot Detection

Bots and crawlers typically do not use cookies which means you may be storing thousands of sessions that serve no purpose. Even worse, an attacker could use your limited session storage against you by flooding your backend, thereby causing your legitimate sessions to get evicted. However, you don't want to misidentify a user as a bot and kill their session unintentionally. This module uses both a regex as well as a counter on the number of writes against the session to determine the session lifetime.

Using with Cm_Cache_Backend_Redis

Using Cm_RedisSession alongside Cm_Cache_Backend_Redis should be no problem at all. The main thing to keep in mind is that if both the cache and the sessions are using the same database, flushing the cache backend would also flush the sessions! So, don't use the same 'db' number for both if running only one instance of Redis. However, using a separate Redis instance for each is recommended to make sure that one or the other can't run wild consuming space and cause evictions for the other. For example, configure two instances each with 100M maxmemory rather than one instance with 200M maxmemory.

License

@copyright  Copyright (c) 2013 Colin Mollenhour (http://colin.mollenhour.com)
This project is licensed under the "New BSD" license (see source).

All versions of magento-redis-session with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package colinmollenhour/magento-redis-session contains the following files

Loading the files please wait ....