- Compare to magento 1.x , magento 2 has come up with various cache configuration, one of these is redis.
- Redis is an open source high performance database, in-memory data structure store. Redis is a key-value store meaning is primarily design to store data using a unique Key.
- Redis is an optional backend cache solution to replace magento2's default Zend_Cache_Backend_File.
- Limitation of default Zend_Cache_Backend_File is core_cache_tag table constantly grows. If a Magento instance has multiple web sites and web stores with large catalogs.
- Advantages of Redis:
- Extreme fast in-memory storage
- Vertical and Horizontal Scaleable
- Shareable among Multi Servers
- Cache Tag Support
- Persistence
Requirements :
- The following are the prerequisites to configure Redis Cache on Magento 2:
- Redis Server
- PHP Redis Extension
- How to configure Magento 2 to use Redis as cache storage?
- 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' => 'https://www.linkedin.com/redir/invalid-link-page?url=127%2e0%2e0%2e1',
'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',
),
),
),
),
- Now flush your cache:
- rm -rf /data/web/magento2/var/cache/*
- redis-cli flushall
- NOTE:
- If redis is working you should not see any files and directories in the folder var/cache/ anymore.
- Further you can connect with "redis-cli info" to check if there entries in the databases.
- Enter the following command:
- redis-cli ping
- PONG should be the response.
- If both commands succeeded, Redis is set up properly.
No comments:
Post a Comment