How to implement redis in Drupal 8?
https://www.zyxware.com/sites/default/files/styles/user_image/public/default_images/index.png?itok=2YmREnrP
BY wellme.m
8 months ago
Drupal-8
0 comments comment

For one of my project, I have implemented the Redis module in Drupal 8. I have used the following configurations as follows:

  • First I download Redis module for a Drupal 8 environment and stored it in 'modules/contrib' directory and enabled the same.
  • For the working of Redis module we need its libraries, so first you have to download the phpredis php extension library from https://github.com/nicolasff/phpredis. Extract the entire contents of the archive into the 'libraries/' folder.

For the working of Redis in local server we have add php extension to our local server. For this follow the steps for seting up Redis Server

  • After that update the settings.php file with the following code:

    $settings['redis.connection']['interface'] = 'PhpRedis';
        // Host ip address.
        $settings['redis.connection']['host']      = '127.0.0.1';
        $settings['cache']['default'] = 'cache.backend.redis';
        // Redis port.
        $settings['redis.connection']['port']      = '6379';
        $settings['redis.connection']['base']      = 12;
        // Password of redis updated in php.ini file.
        $settings['redis.connection']['password'] = "password";
        $settings['cache']['bins']['bootstrap'] = 'cache.backend.chainedfast';
        $settings['cache']['bins']['discovery'] = 'cache.backend.chainedfast';
        $settings['cache']['bins']['config'] = 'cache.backend.chainedfast';
    
  • Create services.yml and add the below code in it.

    services:
      # Cache tag checksum backend. Used by redis and most other cache backend
      # to deal with cache tag invalidations.
      cache_tags.invalidator.checksum:
       class: Drupal\redis\Cache\RedisCacheTagsChecksum
       arguments: ['@redis.factory']
       tags:
         - { name: cache_tags_invalidator }
    
      # Replaces the default lock backend with a redis implementation.
      lock:
        class: Drupal\Core\Lock\LockBackendInterface
        factory: ['@redis.lock.factory', get]
    
      # Replaces the default persistent lock backend with a redis implementation.
      lock.persistent:
        class: Drupal\Core\Lock\LockBackendInterface
        factory: ['@redis.lock.factory', get]
        arguments: [true]
    
      # Replaces the default flood backend with a redis implementation.
      flood:
        class: Drupal\Core\Flood\FloodInterface
        factory: ['@redis.flood.factory', get]
    

Hope this is useful.


RELATED ARTICLE

more_horiz
close

on 21st May 2013 / by Anoop John
Drupal 6 will be maintained till the release of Drupal 8. Drupal 8 release is expected to happen towards the end of 2013. The current stable branch Drupal 7 will be maintained till the release of Drupal 9 (probably 2015). If you are running a production site on Drupal 6 then you will probably have to start looking at upgrading the site by the end of this year. Drupal Drupal 6 Drupal Upgrade Drupal 7 Drupal 8 Leave a reply Your email address will not be published. Required fields are marker *
more_horiz
close

on 26th December 2014 / by abhai.sasidharan
YAML is a data serialization language which is easily readable to both humans and computers. It is for this very reason that YAML is being used in Drupal 8. YAML stands for YAML Ain't Markup Language. Drupal Drupal 8 Leave a reply Your email address will not be published. Required fields are marker *
more_horiz
close

on 29th December 2014 / by abhai.sasidharan
Drupal, up until now a PAC (Presentation Abstraction Control) architecture, has taken a step closer to MVC (Model View Controller) architecture. Although nowhere have they mentioned about MVC, the new Drupal 8 is strictly object oriented. Another feature in Drupal 8, that is different from the existing versions of Drupal is that it is not entirely Drupal. Drupal 8 uses many components in symfony like it's ClassLoader, YAML file structure, twig and so on. For a detailed description please visit the Drupal 8 home page. Drupal Drupal 8 Leave a reply Your email address will not be published. Required fields are marker *
Leave a reply
Your email address will not be published. Required fields are marker *

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type='1 A I'> <li> <dl> <dt> <dd> <h2 id='jump-*'> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
The content of this field is kept private and will not be shown publicly.
CAPTCHA This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.