Magento Expert Forum - Improve your Magento experience

Results 1 to 7 of 7

How to configure Magento 2 to use Redis

  1. #1

  2. #2
    Junior Member
    Join Date
    Sep 2016
    Posts
    220
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    I have not familiar with this, but read it some where, so sharing with you, Out of the box Magento 2 is shipped with redis support and we can use it for cache, sessions and full page cache. Magento 2 cache entries are organized in groups like Configuration, Layous, Blocks HTML Output and so on. If you have shop(s) with a huge amount of products your cache will be very big. Because of that it's highly recommended to use redis as cache backend. Out of the box Magento 2 uses the file system as cache storage which isn't really recommended because it's the slowest cache storage you can use. For each cache group deletion Magento needs to open all files to check if it's in the cache group or not. If you do this with thousand of files, which you will have with a big shop, it will extremely slow down your shop.


    Book Matrimonial Ad in Newspaper
    Last edited by vishnu; 26-03-2019 at 10:05 AM.

  3. #3
    Junior Member kajal's Avatar
    Join Date
    Sep 2014
    Location
    Bangalore
    Posts
    1,446
    Thanks
    0
    Thanked 18 Times in 18 Posts

    Default

    Magento 2 is shipped with redis support and we can use it for cache, sessions and full page cache.:
    To configure Redis for Magento 2 cache, just add the following example to your app/etc/env.php:

    'cache' =>
    array (
    'frontend' =>
    array (
    'default' =>
    array (
    'backend' => 'Cm_Cache_Backend_Redis',
    'backend_options' =>
    array (
    'server' => '127.0.0.1',
    'port' => '6379',
    'persistent' => 0,
    'database' => '0',
    'force_standalone' => '0',
    'connect_retries' => '10',
    'read_timeout' => '30',
    'automatic_cleaning_factor' => '0',
    'compress_data' => '1',
    'compress_tags' => '1',
    'compress_threshold' => '20480',
    'compression_lib' => 'gzip',
    ),
    ),
    ),
    ),


    To configure Magento 2 to use Redis for sessions, just add the following lines to your app/etc/env.php:

    'session' =>
    array (
    'save' => 'redis',
    'redis' =>
    array (
    'host' => '127.0.0.1',
    'port' => '6379',
    'password' => '',
    'timeout' => '5',
    'persistent_identifier' => '',
    'database' => '1',
    'compression_threshold' => '2048',
    'compression_library' => 'gzip',
    'log_level' => '1',
    'max_concurrency' => '6',
    'break_after_frontend' => '5',
    'break_after_adminhtml' => '30',
    'first_lifetime' => '600',
    'bot_first_lifetime' => '60',
    'bot_lifetime' => '7200',
    'disable_locking' => '0',
    'min_lifetime' => '60',
    'max_lifetime' => '2592000'
    )
    )

  4. #4
    Junior Member fay_khattak's Avatar
    Join Date
    Jan 2016
    Location
    Karachi, Pakistan
    Posts
    50
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Redis is a high-speed backend cache with full cache tag support, no need for low-level file system cache and on high traffic Magento stores, the performance is excellent and stable. It is also highly recommended in multi-server environments.

    The following are the prerequisites to configure Redis Cache on Magento 2:

    - Redis Server
    - PHP Redis Extension

    The latest versions are always preferable. To assist you further, I have written a brief tutorial on how to configure Redis with Magento 2. Please have a look at it:

    Install Redis Cache On Magento 2

  5. #5
    Junior Member
    Join Date
    Sep 2018
    Location
    Oman, Muscat
    Posts
    549
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    Design Redis Cache. In this progression, we will arrange Redis on Magento 2. You have to include Redis setup in Magento2_ROOT_Directory > application > and so on > env.php record. In this env.php record, you would locate a substantial PHP exhibit with various settings and setup.

  6. #6
    Junior Member
    Join Date
    Feb 2018
    Posts
    103
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    Magento’s caching is implemented by Magento\Framework\App\CacheInterface

    Add a configuration similar to the following to app/etc/env.php

    'cache' =>
    array(
    'frontend' =>
    array(
    // Default Cache
    'default' =>
    array(
    'backend' => 'Cm_Cache_Backend_Redis',
    'backend_options' =>
    array(
    'server' => '127.0.0.1',
    'database' => '0',
    'port' => '6379'
    ),
    ),
    // Full page cache
    'page_cache' =>
    array(
    'backend' => 'Cm_Cache_Backend_Redis',
    'backend_options' =>
    array(
    'server' => '127.0.0.1',
    'port' => '6379',
    'database' => '1',
    'compress_data' => '0'
    )
    )
    )
    ),


    Seminar Organisers in Delhi | Brand Promotion Companies in Delhi | Artist Management Companies in Delhi

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •