Wednesday, 27 March 2019

Inheritance in PHP


When a programmer writes same code more than once, code duplication problem occurs. Inheritance provides the ability to reduce code duplication in programming.
In inheritance, there is a parent class having its own methods and properties and child class/classes use the code from the parent.
Inheritance make us capable of reuse a piece of code (written only once in parent class) again & again in child class as we need.

Inherit code of another class by a class.

Inheritance provides the capability of reuse the code (written only once in parent class) in both the parent and child classs.
"extends": This keyword declares that one class inherits code from another class. Example:

class Parent {
  // The parent’s class code
}

class Child extends Parent {
  // The  child can use the parent's class code
}

Child class inherits the parent class so child class can use all the non-private methods and properties of parent class. We write code only once in parent and can use this code in both the parent and child classes.
ExampleI am having a parent class "car" and child class "sportsCar". Child class "sportsCar" is inheriting parent class "car" so class sportsCar having access to all of the car's class non-private methods and properties.
We have written setModel() and hello() public methods only once in the parent class. Class sportsCar and car can both use these methods.


//The parent class
class Car {
  // Private property inside the class
  private $model;

  //Public setter method
  public function setModel($model) {
    $this -> model = $model;
  }

  public function hello() {
    return "Hey! I am a <i>" . $this -> model . "</i><br />";
  }
}

//The child class inherits the code from the parent class
class SportsCar extends Car {
  //No code in the child class
}


//Create an instance from the child class
$sportsCar1 = new SportsCar();
 
// Set the value of the class’ property.
// For this aim, we use a method that we created in the parent
$sportsCar1 -> setModel('Ferrari');
 
//Use another method that the child class inherited from the parent class
echo $sportsCar1 -> hello();


Result: Hey! I am a Ferrari


Can a child class have its own methods and properties?


In inheritance, Child class can use all non-private methods and properties of parent class. But child class can have its own methods and properties as well. Child class can use the code inherited from parent class but parent class cannot use the child's class code.
Example: I am adding a property $style and a method driveItWithStyle() in child class as below: 

// The parent class has its properties and methods
class Car {
  
  //A private property or method can be used only by the parent.
  private $model;
  
  // Public methods and properties can be used by both the parent and the child classes.
  public function setModel($model) {
    $this -> model = $model;
  }
   
  public function getModel() {
    return $this -> model;
  }
}

//The child class can use the code it inherited from the parent class, and it can also have its own code 
class SportsCar extends Car{

  private $style = 'fast and furious';

  public function driveItWithStyle() {
    return 'Drive a '  . $this -> getModel() . ' <i>' . $this -> style . '</i>';
  }
}

//create an instance from the child class
$sportsCar1 = new SportsCar();
   
// Use a method that the child class inherited from the parent class
$sportsCar1 -> setModel('Ferrari');
  
// Use a method that was added to the child class
echo $sportsCar1 -> driveItWithStyle();
Result: Drive a Ferrari fast and furious.

The protected access control modifier

When a method or a property declared as protected, Both the parent and child class can use this method or property.
  • Private methods or properties can only be used from inside the class.
  • Public methods or properties can be accessed from both the inside and outside of the class.
  • Protected modifier: which allows code usage from both inside the class and from its child classes.
Example 1: What happen when we declare $model property as private in parent and still try to access it from its child class.

Try to call a private method or property from the outside of the class as done in code below:
Here is the code:

// The parent class
class Car {
  //The $model property is private, thus it can be accessed only from inside the class
  private $model;
  
  //Public setter method
  public function setModel($model) {
    $this -> model = $model;
  }
}
   
// The child class
class SportsCar extends Car{
  //Tries to get a private property that belongs to the parent
  public function hello() {
    return "Hey! I am a <i>" . $this -> model . "</i><br />";
  }
}
   
//Create an instance from the child class
$sportsCar1 = new SportsCar();
  
//Set the class model name
$sportsCar1 -> setModel('Ferrari');
   
//Get the class model name
echo $sportsCar1 -> hello();
Result:  Notice: Undefined property: SportsCar::$model

In above example, we get an error because hello() method (in child class) trying to use $model private property of parent class.

Now to fix above error, we can declare $model property as protected instead of private. Because when we declare a method or property as protected, this method or property can be used in both the parent and child classes..

// The parent class
class Car {
  //The $model property is now protected, so it can be accessed 
  // from within the class and its child classes
  protected $model;
   
  //Public setter method
  public function setModel($model) {
    $this -> model = $model;
  }
}
  
// The child class
class SportsCar extends Car {
  //Has no problem to get a protected property that belongs to the parent
  public function hello() {
    return "Hey! I am a <i>" . $this -> model . "</i><br />";
  }
}
  
//Create an instance from the child class
$sportsCar1 = new SportsCar();
  
//Set the class model name
$sportsCar1 -> setModel('Ferrari');
  
//Get the class model name
echo $sportsCar1 -> hello();

Result: Hey! I am a Ferrari.

Now it works, because we can access a protected code that belongs to a parent from a child class.

Override parent’s methods and properties in the child class?

Child class can have its own methods and properties. Child class can also override the methods and properties of the parent class as well.
To override class methods and properties, rewrite that method or property in child class which already exists in the parent class but write different code in method or assign different value to properties.
Example: created hello() method in the parent class that is returning string "Hey". Now after override this hello() method in child class, it is returning a different string "Hello". To override this hello() method name must be same as of parent class method name.

Here is the code:

// The parent class has hello method that returns "Hey".
class Car {
  public function hello() {
    return "Hey";
  }
}

//The child class has hello method that returns "Hello"
class SportsCar extends Car {
  public function hello() {
    return "Hello";
  }
}
    
//Create a new object
$sportsCar1 = new SportsCar();
  
//Get the result of the hello method
echo $sportsCar1 -> hello();

Result: Hello

The result reflects the fact that the hello() method from the parent class was overridden by the child method with the same name.

Prevent overriding the parent' methods by child class

To prevent overriding method of parent class in the child class, use "final" keyword. prefix "final" keyword in the parent method.

Example: I have declared hello() method as final in parent class and still try to override it in the child class. What will happen?
Or what will happen when we try to override a final method?

// The parent class has hello method that returns "Hey".

class Car {
  final public function hello() {
    return "Hey";
  }
}

//The child class has hello method that tries to override the hello method in the parent
class SportsCar extends Car {
  public function hello() {
    return "Hello";
  }
}

//Create a new object
$sportsCar1 = new SportsCar();
  
//Get the result of the hello method
echo $sportsCar1 -> hello();
Result: Fatal error: Cannot override final method Car::hello()

Since we declared the hello method as final in the parent, we cannot override the method in the child class.

Tuesday, 26 March 2019

Update Drupal Core software with Drush/Admin Interface

Update Drupal 8 Core software

Requirement: Drush (If want to update with the help of Drush)
Note: In case of live site, test this process development environment before running on production environment.

Follow below steps:
1. Take complete backup of site.
2. Edit settings.php (/sites/default/settings.php) in notepad++ or any text editor. Find  "$settings[update_free_access]" variable. By default, due to security reasons, it is set "FALSE". 
Update this variable to "TRUE" as below:
$settings['update_free_access'] = TRUE;
3. If you are using any caching technique, Disable it.
4. Put your site in maintenance mode by going to admin > configuration > Development > Maintenance Mode url is /admin/config/development/maintenance.
5. If composer is already in used to manage dependencies, Run the composer update and visit the http://www.example.com/update.php in browser. Now click continue in the first screen to run the updates and successfully complete the script.

6. If you are not using composer then follow below steps.
     a. Download the latest Drupal core file from the drupal.org Drupal Core Software
     b. Extract downloaded file in any temp folder.
     c. Delete the core and vendor directory and all files that are not in sub-directory like .htaccess, composer.json and autoload.php. Do not delete custom files which you have created or customized.
     d. Copy core, vendor directory as well all non-custom files(that are deleted) from temp directory to site directory.
     e. Visit http://www.example.com/update.php. Click continue in the first screen to run the updates. Run the Drush command: drush updb   
     f. If there is any error or warning, re-run the update.php again till all the updates have been completed successfully.
7. Update again settings.php file with "FALSE" value of the variable $settings['update_free_access'] as below : $settings['update_free_access'] = FALSE;
8. Now put your site out of maintenance mode by going to admin > configuration > Development > Maintenance Mode url is /admin/config/development/maintenance.
9. Clear cache.
10. Enable caching techniques which is disabled before update.
11. Now verify the updated version by going to the admin > Reports > Status Report.












Monday, 25 March 2019

Integrate Kafka with Drupal 8

Integrate Kafka with Drupal 8

Kafka:

Kafka is publish-subscribe messaging system. It is used in real-time streaming data architecture provide real-time analytics. It is fast, scalable, durable, and fault-tolerant. 

Kafka is used for stream processing, website activity tracking, metrics collection and monitoring, log aggregation, real-time analytics, replay messages, error recovery, guaranteed distributed commit log for in-memory computing (microservices) etc.

Requirements:
  • Zookeeper and kafka installation.
  • "librdkafka" client library.
  • "php-rdkafka" PHP extension.
  • Drupal version >= 8.2.0
  • Drupal contributed module kafka.
Install Zookeeper & Kafka
Zookeeper
  • Installing apache zookeeper: Download zookeeper or wget http://www-us.apache.org/dist/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz in "/opt/" and tar -zxvf.
  • create /opt/zookeeper_data directory by command "mkdir /opt/zookeeper_data".
  • cd zookeeper-3.4.10.
  • cd zookeeper-3.4.10/conf
  • rename or cp zoo_sample.cfg zoo.cfg
  • Now check for the properties in zoo.cfg file.
  • vim conf/zoo.cfg
  • Set following in zoo.cfg
  • dataDir : set it "/opt/zookeeper_data".
  • clientPort : set it 2181.
  • ./bin/zkServer.sh start
  • To verify status of zookeeper "jps".
  • If zookeeper has started successfully then process will appear with process id : "QuorumPeerMain" like 10956 QuorumPeerMain.

Kafka
  • To configure apache Kafka : Download kafka or wget http://www-us.apache.org/dist/kafka/1.0.0/kafka_2.11-1.0.0.tgz  in "/opt/" and tar -zxvf.
  • cd kafka_2.11-1.0.0/config
  • Now see file "server.properties" in config directory.
  • Edit server.properties with command : vi config/server.properties
  • Check for the properties in server.properties
  • Borker_id=1 (By default it is 1)
  • Port=9092 (If it is not present then by default it is 9092)
  • Zookeeper.connect=127.0.0.1:2181(If it is localhost then no need to update)
Now start apache kafka brokers


./bin/kafka-server-start.sh -daemon config/server.properties
Now check running kafka precesses by command "jps".




Create topic
./bin/kafka-topics.sh --create --zookeeper 127.0.0.1:2181 --topic test-topic --partitions 2 --replication-factor 1
 Output will : Created topic "test-topic".

Sending message
./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test-topic

After above commad type your message “Hi, its first test message.” And press enter.
Then press ctrl+z;

Consume message
./bin/kafka-console-consumer.sh --zookeeper 127.0.0.1:2181 --topic test-topic --from-beginning

Install rdkafka php extension
To install gcc: sudo apt-get install gcc
To install C++ compiler: sudo apt-get install g++
To install make: sudo apt-get install build-essential
To install phpize: sudo apt install php7.0-dev

Install librdkafka library.
git clone https://github.com/edenhill/librdkafka.git
cd librdkafka/
./configure
sudo make install
sudo pecl install rdkafka

Then go to Drupal root directory.

composer require enqueue/rdkafka
composer require nmred/kafka-php

Make entry of "extension=rdkafka.so" in etc/php/7.0/apache2/php.ini AND in etc/php/7.0/cli/php.ini.
Restart Apache.

Download and install drupal 8 contributed kafka module.
Create configuration in settings.php
Configure "settings.php" to expose kafka queue.
$settings['queue_default'] = 'queue.kafka';
$settings['queue_service_{queue_name}'] = 'queue.kafka';
$settings['kafka'] = [
  'consumer' => [
'brokers' => ['127.0.0.1']
  ],
  'producer' => [
'brokers' => ['127.0.0.1'],
  ],

];

Now you can check above created topic with drush command: drush kt

Now create custom module and use below code lines.

// Calling the Kafka producer service
$rk = \Drupal::service('kafka.producer');
$rk→setLogLevel(LOG_WARNING);

// Creating a topic.
$topic_name = 'kafka_test_topic';
$topic = $rk→newTopic($topic_name);

// Defining the content of the message (item)
$message = '{
  "title": "' . $nodetitle . '",
  "type": "' . $contenttype . '",
  "properties": {
    "node": {
      "nid": "' . $nodeid . '"
    }
  }
 }';
if ($topic) {
  // Pushing the topic in drupal queue.
  $q = \Drupal::queue($topic_name);

  //Creating the drupal QUEUE
  $q→createQueue();

  //Creating the message (item)
  $dev = $q->createItem($message);
}

Drupal 8 Custom module for kafka message
custom_kafka
custom_kafka.info.yml
custom_kafka.module

Now custom_kafka.info.yml
name: Custom kafka
description: custom module to integrate kafka with Drupal
package: custom
type: module
core: 8.x

custom_kafka.module
Now call below function to send kafka message on add/update/delete hook of entity.
/**
 * Function to set message in queue.
 *
 * @param string $topic_name
 *   Topic Name.
 * @param mixed $message
 *   Message.
 */
function kafka_message($topic_name, $message) {
  $topic_message = 'Topic_Name:' . $topic_name . ' #Message_Value:';
  try {
    $q = \Drupal::queue($topic_name);
    $q->createQueue();
    $q->createItem($message);
    $topic_message .= $message;
    \Drupal::logger('custom_kafka')->info($topic_message);
  }
  catch (Exception $ex) {
    $topic_message .= $ex->getMessage();
    \Drupal::logger('custom_kafka')->error($topic_message);
  }
}


Wednesday, 20 March 2019

Aggregator Module Configuration Drupal 8

Drupal 8 having aggregator module in its core.
Aggregator module allows to collect information from external sources and then publish this information on our website. This information can include RSS, RDF, or Atom feeds.
For example, if you want to publish a list of headlines and article summaries from an external news site, Use aggregator module.

RSS
  • RSS stands for Rich Site Summary. It is used to monitor rapidly changing information in an organized and user-friendly way on the web.
  • This monitors news sites, blogs, Twitter or Facebook pages, financial information, daily deals, classified sites and government alerts.
  • By posting a "feed" on their page, web site owners allows RSS readers to search their site continuously look for fresh and new information.
RDF
  • RDF stands for Resource Description Framework which describe resources on the web.
  • RDF is a standard model for data interchange on the web and it facilitates data merging even if the underlying schemas are differ.
  • RDF is designed to be read and understood by computers but not for being displayed to people.
  • RDF is written in XML.
  • Examples: Describing properties for shopping items, such as price and availability, Describing time schedules for web events, Describing information about web pages (content, author, created and modified date), Describing content and rating for web pictures, Describing content for search engines, Describing electronic libraries
Atom
  • Atom is a simple way to read and write information on the web, allows you to easily keep track of more sites in less time, and to seamlessly share your words and ideas by publishing to the web.
  • The Atom format was developed as an alternative to RSS.

Enable aggregator core module. 
Once enabled, the module provides a new screens for us to manage external site feeds.
See configuration page listed under "Web Services" sections





After clicking on the "Aggregator" link, it will take us to Feed overview page where existing feeds are listed and can be add new ones.


Example: Set up headline feed from the BBC news website having RSS feed link: http://feeds.bbci.co.uk/news/rss.xml?edition=uk
Click on "Add feed" and fill details as shown in image. 

Save new feed and will get confirmation message of feed creation.
Feed is empty because the Aggregator module only gets triggered to check for new content on a cron run. 
Run cron with the help of command drush cron or visit the feeds overview page.
Locate the BBC news feed just setup.
Open up the menu in the rightmost OPERATIONS column and click on the Update items button:
You should then see that the number of items is set.

NOTE: Aggreagtor module try to update your feed every hour but cron is set to 3 hours by default. So if you really wants to update feed every hour, then set cron to run once per hour.
Aggregator module provides a dedicated block for each feed which is created. Now we will add the BBC news block to Sidebar First region. 

To do this Navigate to Structure > Block Layout

Go to sidebar first region and click on the place block button, Select BBC news block as shown in screenshot. 




Choose the feed from the list "Select the feed that should be displayed". In this case it is BBC News
Save the block.
Now This block will start to appear on sidebar_first.




There is another screen provided by the Aggregator module by navigating to Manage > Configuration > Web Services > Feed aggregator (admin/config/services/aggregator).

Click on the Settings tab to see the details:






Now see the above BBC News block view.

Tuesday, 19 March 2019

Memcache Integration with Drupal 8

Memcache

Memcache improves Drupal application performance by moving standard caches out of the database and caching the results of other expensive database operations. Memcache stores these caches/DB objects in RAM.

Install memcache on the server and configure it with Drupal 8 to reduce the load on the database with every page load.

Install memcache on server
1. Run the following commands in terminal.
    sudo apt-get update
    sudo apt install memcached
    sudo apt install php-memcached
2. Run following command to make sure memcache daemon is working fine.
    ps aux | grep memcached
3. Create phpinfo.php page and check there "memcached" extension is properly configured in PHP7
    vim /var/www/html/phpinfo.php
4. Restart both memcached and php7-fpm services.
    service memcached restart
    service php7.0-fpm restart
    check in browser by opening above create phpinfo.php file.










5. After installing memcache in your server, download Memcache module and Memcache Storage Module
Memcache module having 2 submodules: 
1. Memcache  2. Memcache Admin. Enable memcache and memcache admin module.

Configure Memcache and Memcache Admin module Drupal 8
1. Add below configurations in settings.php file.
/**
 * Memcache settings
 */
$settings['memcache']['servers'] = ['127.0.0.1:11211' => 'default'];
$settings['memcache']['bins'] = ['default' => 'default'];
$settings['cache']['default'] = 'cache.backend.memcache';
$settings['memcache']['key_prefix'] = 'cms_memcache_';
$settings['cache']['bins']['bootstrap'] = 'cache.backend.memcache';
$settings['cache']['bins']['discovery'] = 'cache.backend.memcache';
$settings['cache']['bins']['config'] = 'cache.backend.memcache';
$settings['cache']['bins']['container'] = 'cache.backend.memcache';
$settings['cache']['bins']['data'] = 'cache.backend.memcache';
$settings['cache']['bins']['default'] = 'cache.backend.memcache';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.memcache';
$settings['cache']['bins']['entity'] = 'cache.backend.memcache';
$settings['cache']['bins']['menu'] = 'cache.backend.memcache';
$settings['cache']['bins']['page'] = 'cache.backend.memcache';
$settings['cache']['bins']['render'] = 'cache.backend.memcache';
$settings['cache']['bins']['rest'] = 'cache.backend.memcache';
$settings['cache']['bins']['signal'] = 'cache.backend.memcache';
$settings['cache']['bins']['toolbar'] = 'cache.backend.memcache';
$settings['cache']['bins']['ultimate_cron_logger'] = 'cache.backend.memcache';


2. Memcache statistics can be seen on the admin > Reports > Memcache Statistics as in screenshot.




3. To enable statistics on all pages. go to admin > config > system > memcache







 4. Now visit a single page and see the statistics for that page.
a. First time page load. 







b. After first time page load. 






Now compare the page load time in above both screenshot. After first time load, page is coming from the memcache and page load time has been decreased.


Configuring Memcache and Memcache Storage with Drupal 8
1. Paste the below code after opening the settings.php file.
    // Set’s default cache storage as Memcache and excludes database connection for cache
    $settings['cache']['default'] = 'cache.backend.memcache_storage';
   // Set’s Memcache key prefix for your site and useful in working sites with same memcache as           backend.
   $settings['memcache_storage']['key_prefix'] = '';
  // Set’s Memcache storage server’s.
  $settings['memcache_storage']['memcached_servers'] =  ['127.0.0.1:11211' => 'default'];

2. To debug Memcache, include below code in settings.php file.
// Enables to display total hits and misses
$settings['memcache_storage']['debug'] = TRUE;

Now you can see Memcache messages by debug enabled in above line.

NOTE: Comment memcache settings from settings.php file before uninstalling Memcache and Memcache storage.

Redis Integration with Drupal 8

Redis

  • Redis is a in-memory, key-value data store. Redis is the most popular key-value data store. 
  • Redis is used by all big IT brands in this world. Amazon Elastic Cache supports Redis which makes redis a very powerful and must know key-value data store.
  • Key-Value store is a storage system where data is stored in the form of key and value pairs.
  • In-memory Key-Value store means Key-Value pairs are stored in primary memory (RAM).
  • Redis stores data in the form of Key-Value in RAM.
  • Key: This has to be string
  • Value: This can be string, list, set or hash
  • Example: 
           name="raj"
           skills=["Drupal8", "Drupal7"]
  • In Database Management system, everything got stored in secondary storage due to which read and write operations are very slow But Redis store everything in primary memory and very fast to read/write of data.
  • Redis can only store small textual information which has to access, modify or insert with fast speed because It stores in primary memory which is very expensive and lesser size.
  • Redis Architecture having 2 processes:

              1. Redis clientRedis server is responsible for storing data in memory.
              2. Redis server: Redis client can be redis console client which is responsible for sending and receiving data.

Integrating Redis with Drupal 8

Requirement: 
  • PHP >= 7.0.28
  • Install Phpredi module/extension for PHP to communicate: PHPRedis

Follow below steps:
1. Run command:
       sudo apt-get update
   sudo apt-get upgrade
   sudo apt-get install software-properties-common
   sudo add-get-repository ppa:chris-lea/redis-server
   sudo apt-get update
   sudo apt-get upgrade
2. git clone https://github.com/phpredis/phpredis.git
3. cd phpredis
4. phpize
5. ./configure
6. make
7. make install
8. make test
9. cd ..
10. rm –f phpredis
11. echo “extension=redis.so” > /etc/php/7.0/mods-available/redis.ini
12. ln –sf /etc/php/7.0/mods-available/redis.ini  /etc/php/7.0/fpm/conf.d/20-redis.ini
13. ln –sf /etc/php/7.0/mods-available/redis.ini  /etc/php/7.0/cli/conf.d/20-redis.ini
14. service php7.0-fpm restart
15. put extension=redis.so in /etc/php/7.0/apache2/php.ini
16. Restart apache2
17. Now download Drupal module with drush: drush dl redis. OR go to page: https://www.drupal.org/project/redis
18. Now configure redis in Drupal. Now update settings.php file with following code.

/**
* Redis settings
*/ 
$settings['redis.connection']['interface'] = 'PhpRedis';       // Can be "Predis" in the future
$settings['redis.connection']['host'] = '127.0.0.1';         // Your Redis instance hostname
$settings['cache_prefix'] = 'cms_';         // Optional prefix for cache entries

$settings['cache']['default'] = 'cache.backend.redis';  // The default cache engine for the site
// Always set the fast backend for bootstrap, discover and config, otherwise this gets lost when redis is enabled.
$settings['cache']['bins']['bootstrap']    = 'cache.backend.chainedfast';
$settings['cache']['bins']['discovery']    = 'cache.backend.chainedfast';
$settings['cache']['bins']['config']       = 'cache.backend.chainedfast';
$settings['cache']['bins']['container']       = 'cache.backend.redis';
$settings['cache']['bins']['data']       = 'cache.backend.redis';
$settings['cache']['bins']['default']       = 'cache.backend.redis';
$settings['cache']['bins']['dynamic_page_cache']       = 'cache.backend.redis';
$settings['cache']['bins']['entity']       = 'cache.backend.redis';
$settings['cache']['bins']['menu']       = 'cache.backend.redis';
$settings['cache']['bins']['page']       = 'cache.backend.redis';
$settings['cache']['bins']['render']       = 'cache.backend.redis';
$settings['cache']['bins']['rest']       = 'cache.backend.redis';
$settings['cache']['bins']['signal']       = 'cache.backend.redis';
$settings['cache']['bins']['toolbar']       = 'cache.backend.redis';
$settings['cache']['bins']['ultimate_cron_logger']       = 'cache.backend.redis';

$settings['container_yamls'][] = 'modules/redis/example.services.yml';
$settings['container_yamls'][] = 'modules/redis/redis.services.yml';

//Register our namespace
$class_loader->addPsr4('Drupal\\redis\\', 'modules/redis/src');

19. Start redis-server, run command: redis-server
20. Now in CLI windows: redis-cli monitor. this command will print OK means it is working fine. 

21. Check if redis is configured with Drupal. Go to admin > Reports > Status Report. Click on Status report and see the status report page.





22. Now access any Drupal website page and now you will be able to see the logs as below with the following command: redis-cli. Now this command will take to the redis client terminal.



Now here type below command to see redis cache storage.

Command: keys ‘cms*’ as in below screen shot.


If you want to see specific logs, then run above command as below: keys ‘cms_:entity*’