Back to Top

Prestashop Redis Cache {User-Guide}

Updated 28 June 2024

Prestashop Redis Cache helps in improving the loading time of your store. It creates an in-memory cache to store high-level data types.

Note: PrestaShop Redis Cache module is compatible with PrestaShop version 8.x.x.

Check the overview of the plugin in the video mentioned-below –

nESCFOt7LyM

Features

  • Improves the loading time of the web pages by using a structured way to store data in memory.
  • A faster loading website leads to improved customer experience.
  • Reduces the bounce rate on the website.
  • Stores cache in Redis.
  • Stores page cache in Redis.
  • Improve the overall performance of your Prestashop store.

Installation

  • Firstly, go to the Module Manager in Back office and click on ‘upload a module’.
  • After that, Drag and drop the module file or select the file from the system.
  • In this way, the module installation will be successful.
upload module
upload file
configure module button

NOTE:

In Prestashop, version 1.7.3.x, to display CachePhpRedis radio option on the performance->caching section. Please add the following code in CachingType.php file.

Path: prestashop/src/PrestaShopBundle/Form/Admin/AdvancedParameters/Performance/CachingType.php

Searching for an experienced
Prestashop Company ?
Find out More

(1) Add this code:-

use PrestaShop\PrestaShop\Core\Addon\Module\ModuleManagerBuilder;

At line 34, just after use Symfony\Component\OptionsResolver\OptionsResolver;

(2) Add this code:-

public function isWkRedisModuleEnabled()
{
$moduleManagerBuilder = ModuleManagerBuilder::getInstance();
$moduleManager = $moduleManagerBuilder->build();
if ($moduleManager->isInstalled('wkrediscache') && $moduleManager->isEnabled('wkrediscache')) {
return true;
}

return false;
}

At line 46, Just after

private $extensionsList = [
'CacheMemcache' => ['memcache'],
'CacheMemcached' => ['memcached'],
'CacheApc' => ['apc', 'apcu'],
'CacheXcache' => ['xcache'],
];

(3) Add this code:-

$choices = array(
'Memcached via PHP::Memcache' => 'CacheMemcache',
'Memcached via PHP::Memcached' => 'CacheMemcached',
'APC' => 'CacheApc',
'Xcache' => 'CacheXcache',
);
if ($this->isWkRedisModuleEnabled()) {
$choices['CachePhpRedis'] = 'CachePhpRedis';
$this->extensionsList['CachePhpRedis'] = array('CachePhpRedis');
}

At line 61, just after public function buildForm(FormBuilderInterface $builder, array $options) {

(4) Remove this below code from line 74 to 79 just after ->add(‘caching_system’, ChoiceType::class, [

'choices' => [
'Memcached via PHP::Memcache' => 'CacheMemcache',
'Memcached via PHP::Memcached' => 'CacheMemcached',
'APC' => 'CacheApc',
'Xcache' => 'CacheXcache',
],

And add this below code at line 74

'choices' => $choices,

(5) Add this code:-

if ($this->isWkRedisModuleEnabled()) {
if ($extensionName == 'CachePhpRedis') {
$disabled = false;
break;
}
}

At line 91, just after foreach ($this->extensionsList[$index] as $extensionName) {

(6) Add this code

'CachePhpRedis' => $this->trans('CachePhpRedis', 'Admin.Advparameters.Feature')

At line 179, just after

'CacheXcache' => $this->trans('Xcache', 'Admin.Advparameters.Feature')
. ' '
. $this->trans(
'(you must install the [a]Xcache extension[/a])',
'Admin.Advparameters.Notification',
[
'[a]' => '<a href="http://xcache.lighttpd.net" target="_blank">',
'[/a]' => '</a>',
]
),

Module Configuration

After the successful installation of the module, follow the below steps.

  • Firstly go to the Advanced Parameters section.
  • Then go to the caching section in the performance tab.
  • At last, you need to enable caching.
Performance Demo

Firstly, you enable cache and select Redis as caching system. After that, you can configure the module.

In the configuration settings, you need enter following details

  • Redis server IP
  • Port of Redis server
  • Authentication key(if applicable)
  • and the Database number
Prestashop Redis Cache configuration

In case, if admin doesn’t enable caching, then admin can not configure the module. As a result, the shop will not be connected with Redis.

Prestashop Redis Cache configurations

So, This was all about Prestashop Redis Cache Module. Moreover, this document will help you in checking the functionality of the module in a better way. Also, do let us know about your views in the comments.

Support

For any kind of technical assistance or query, please raise a ticket or send us a mail at [email protected]

Also, please explore our Prestashop development services and vast range of quality Prestashop addons.

Current Product Version - 4.0.4

Supported Framework Version - 8.x.x, 1.7.x.x

Blog Version - 8.x.x, 1.7.x.x
  • Version 8.x.x, 1.7.x.x
  • Version 1.6.x.x
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


4 comments

  • Kuba
    • Anuj Verma (Moderator)
  • spott
    • Anuj Verma (Moderator)
  • Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home

    Table of Content