<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Aria Azadi Pour</title>
    <description>The latest articles on Forem by Aria Azadi Pour (@devaddict).</description>
    <link>https://forem.com/devaddict</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F472129%2F1562a60c-d235-429d-bb53-7cab8cb552b6.jpeg</url>
      <title>Forem: Aria Azadi Pour</title>
      <link>https://forem.com/devaddict</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/devaddict"/>
    <language>en</language>
    <item>
      <title>What is the best programming language to start with?</title>
      <dc:creator>Aria Azadi Pour</dc:creator>
      <pubDate>Tue, 16 Nov 2021 19:25:29 +0000</pubDate>
      <link>https://forem.com/devaddict/what-is-the-best-programming-language-to-start-with-339b</link>
      <guid>https://forem.com/devaddict/what-is-the-best-programming-language-to-start-with-339b</guid>
      <description></description>
      <category>discuss</category>
      <category>beginners</category>
      <category>programming</category>
      <category>career</category>
    </item>
    <item>
      <title>Redis Quick Tutorial!</title>
      <dc:creator>Aria Azadi Pour</dc:creator>
      <pubDate>Tue, 16 Nov 2021 10:36:27 +0000</pubDate>
      <link>https://forem.com/devaddict/redis-quick-tutorial-4h7p</link>
      <guid>https://forem.com/devaddict/redis-quick-tutorial-4h7p</guid>
      <description>&lt;p&gt;In this article, you will learn about Redis and what it does, and how you can use it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install Redis
&lt;/h2&gt;

&lt;p&gt;First, you need to install Redis. It is important to practice while learning. If you haven't already Installed Redis you can check out &lt;a href="https://redis.io/download" rel="noopener noreferrer"&gt;Redis's official download page&lt;/a&gt; or you can check out my article on &lt;a href="https://dev.to/devaddict/how-to-install-redis-on-your-os-of-choice-4gdd"&gt;&lt;code&gt;How to install Redis on your OS of choice?&lt;/code&gt;&lt;/a&gt;. My preferred way of installing/using Redis is via Docker.&lt;/p&gt;

&lt;h2&gt;
  
  
  Redis, Itself
&lt;/h2&gt;

&lt;p&gt;Redis is a very popular database. It is usually used for caching data and one of its main features is being an in-memory database which makes it very fast and very good for caching which is its main purpose.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker. Redis provides data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes, and streams. Redis has built-in replication, Lua scripting, LRU eviction, transactions, and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.&lt;/p&gt;

&lt;p&gt;from &lt;a href="//redis.io"&gt;redis.io&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Redis is a database in the family of key-value databases. That means you can store a value with a key and later on use that key to get the value again.&lt;/p&gt;

&lt;h3&gt;
  
  
  Redis Commands
&lt;/h3&gt;

&lt;p&gt;Redis has multiple commands that you can use to work with the database. The commands have an overall structure, look at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SET user:name "Aria"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the example at top, we are saving the value &lt;code&gt;"Aria"&lt;/code&gt; with the key of &lt;code&gt;"user:name"&lt;/code&gt;. We will the SET command later but for now, let's focus on the structure of the command that we just called. Look at the structure below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; ACTION (...arguments)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Redis, the structure is like what we have shown you at the top. &lt;code&gt;ACTION&lt;/code&gt; is the command that we want to call, for example in our first example the &lt;code&gt;SET&lt;/code&gt; command that we called is the action that we are asking Redis to take, and then the rest of the detail given to the command are the arguments that Redis uses to do the action that we have asked the database.&lt;/p&gt;

&lt;p&gt;So with this knowledge in mind, let's continue our journey.&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic Redis Commands
&lt;/h2&gt;

&lt;p&gt;In this section, we are going to talk about the basic Redis commands, how we can save a key-value pair, and how to get and delete that value on the database.&lt;/p&gt;

&lt;h3&gt;
  
  
  Saving key-value pairs
&lt;/h3&gt;

&lt;p&gt;One of the important things that we need to do is to save data on our database. For such action, we can use the &lt;code&gt;SET&lt;/code&gt; command. Look at the syntax below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SET KEY VALUE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using this syntax we can save data in our databases. We need to replace the &lt;code&gt;KEY&lt;/code&gt; with the chosen key and replace the &lt;code&gt;VALUE&lt;/code&gt; with the value that we want to save on the database. Look at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SET user:age 17
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So let's explain the example at the top. We are saving the value &lt;code&gt;17&lt;/code&gt; with the key of &lt;code&gt;user:age&lt;/code&gt;. Very basic, but very useful and important.&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting value
&lt;/h3&gt;

&lt;p&gt;After storing the value that we want in the database we need a way to receive the stored data. For this, we can use the &lt;code&gt;GET&lt;/code&gt; command. Look at the syntax below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; GET KEY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using this syntax we can receive the data stored in the database. We need to replace the &lt;code&gt;KEY&lt;/code&gt; with the key that we used when we were saving the value in the database. Look at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; GET user:age
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you did exactly as I did in the example of saving key-value pairs, you will receive the line bellow in the return of this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"17"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See, quite easy to start. Using these commands we can save and receive the values that we need and it will be extremely fast to use this database to work with our data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deleting value
&lt;/h3&gt;

&lt;p&gt;Now that we can store and receive the value that we have saved, it's time to take it forward and delete some of the values that we have said. For deleting stored values we use the syntax below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; DEL KEY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this syntax, we will be able to delete the unwanted values saved on our database. Look at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; DEL user:age
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you did exactly as I did in the examples before you will see the result of an &lt;code&gt;(integer) 1&lt;/code&gt;, something like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(integer) 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you try this command again you will receive an &lt;code&gt;(integer) 0&lt;/code&gt;, meaning that the key that you have given to the command doesn't exist. The result will be something like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(integer) 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Getting non-existing value
&lt;/h3&gt;

&lt;p&gt;When you delete a value or never create one with the key that you what to receive value with, you will get a &lt;code&gt;nil&lt;/code&gt; value in return for your &lt;code&gt;GET&lt;/code&gt; command. Look at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; GET user:age
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you continued every step that I took, you will not have anything stored with the key of &lt;code&gt;user:age&lt;/code&gt; and you will receive &lt;code&gt;nil&lt;/code&gt; in the result. It will be something like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(nil)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Check value existence
&lt;/h3&gt;

&lt;p&gt;If you want to check if a key holds a value in the database you can use the &lt;code&gt;EXISTS&lt;/code&gt;. Look at the syntax below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; EXISTS user:age
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will return an integer number, 1 or 0, 1 meaning yes, and 0 meaning no.&lt;/p&gt;

&lt;p&gt;Let's store a new value in our database:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SET user:occupation "developer"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let's check if it exists on the database or not:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; EXISTS user:occupation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will return an &lt;code&gt;(integer) 1&lt;/code&gt; in a result like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(integer) 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's check if the record that we have deleted on the database, exists or not:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; Exists user:age
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will return an &lt;code&gt;(integer) 0&lt;/code&gt;, which means the record doesn't exist on the database. See the result below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(integer) 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we know the basics of a Redis database and already we can do a lot with our knowledge but let's take it forward in the next sections.&lt;/p&gt;

&lt;h2&gt;
  
  
  Working With Numbers
&lt;/h2&gt;

&lt;p&gt;In this section, we are going to cover a couple of commands to work with numbers in Redis. It's important to keep in mind that Redis doesn't save numbers and integers or floating points in the database and instead saves them as string, but if you use these commands on the string that are numbers it will work perfectly without any problems.&lt;/p&gt;

&lt;p&gt;For this section, let's create a record to save the number of user's devices:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SET user:devices 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Increasing and Decreasing numbers by 1
&lt;/h3&gt;

&lt;p&gt;Redis has two commands that help us increase or decrease numbers by one, the &lt;code&gt;INCR&lt;/code&gt; command is used to increase a number by one and the &lt;code&gt;DECR&lt;/code&gt; command is used to decrease a number by one. Look at the syntax for increasing a number:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; INCR KEY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And look at the syntax for decreasing a number:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; DECR KEY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see it is pretty clear and easy to work with these commands. When you call these commands it will return the new integer value. Look at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; INCR user:devices
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will increase the value stored at user:devices by one and return the new value which in our case is &lt;code&gt;(integer) 3&lt;/code&gt;. It will return the line below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(integer) 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's see an example of decreasing the number by one. Look at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; DECR user:devices
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will also return the new value just like the increasing command. It will return the line below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(integer) 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Increasing and Decreasing number by value of choice
&lt;/h3&gt;

&lt;p&gt;Other than increasing and decreasing numbers by one we also can increase and decrease it with any value that we choose. There are two commands to do these actions, &lt;code&gt;INCRBY&lt;/code&gt; and &lt;code&gt;DECRBY&lt;/code&gt;. Look at the syntax for &lt;code&gt;INCRBY&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; INCRBY KEY INCREMENT
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And look at the syntax below for &lt;code&gt;DECRBY&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; DECRBY KEY DECREMENT
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In these syntaxes, the &lt;code&gt;KEY&lt;/code&gt; is the key that we used to store the value like always and the &lt;code&gt;INCREMENT&lt;/code&gt; and the &lt;code&gt;DECREMENT&lt;/code&gt; should be replaced by the values that we want to use. Loot at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; INCRBY user:devices 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we are increasing the value stored by 2 and as the commands that we talked about before this command also return the new stored value, like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(integer) 4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the same goes for the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; DECRBY user:devices 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example we are decreasing the value stored by 2 and same as before it will return the new value like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(integer) 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Errors in working with numbers
&lt;/h3&gt;

&lt;p&gt;There can be some errors accrued while working with numbers that are important to keep in mind. In this part we are going to talk about some of the most problems accrued in this area and then talk about how numbers work more in detail.&lt;/p&gt;

&lt;h4&gt;
  
  
  Non-integer values
&lt;/h4&gt;

&lt;p&gt;There can be many times which you accidentally or unknowingly use these commands on non-integer values. It is important to note that you can only use these commands on integers and you can't use them even on floating points.&lt;/p&gt;

&lt;p&gt;Let's see this in practice. Now I'm going to store a new record in the database for the user's amount of money in the wallet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SET user:wallet 7.89
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's try to increase it using the &lt;code&gt;INCR&lt;/code&gt; command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; INCR user:wallet
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you try to take this action you will face the error below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(error) ERR value is not an integer or out of range
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This error means that these actions can not be taken on the value stored with the provided key.&lt;/p&gt;

&lt;h4&gt;
  
  
  Out of range integers
&lt;/h4&gt;

&lt;p&gt;As you see in the error accrued on incrementing non-integers, it said the value is either not an integer or out of range. Redis numbers work on a 64 bit signed integer system, so when you want to work with a number out of this system Redis will return an error. &lt;/p&gt;

&lt;p&gt;Let's see this in action. First, we are going to store a new value in the database for the user's ID that exceeds the limit of a 64 bit signed system:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SET user:id "12345678912345678901"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The value that we have saved is clearly out of the 64 bit signed number system. Now let's try to increase the number using the &lt;code&gt;INCR&lt;/code&gt; command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; INCR user:id
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using this command on this record in the database will return the familiar error that we saw in the past like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(error) ERR value is not an integer or out of range
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This time this error accrued because the number was too big for Redis to process and It is important to keep this note in mind and don't use increment and decrement commands for potentially big numbers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Expiration
&lt;/h2&gt;

&lt;p&gt;As I said Redis is used a lot for caching And if you know a little bit about caching you are aware that the data that has been cached is not there to stay forever and at some point, we want to get rid of it and set a new value or recalculate it or many other actions. We can easily automate such actions by setting an expiration date and time for the record that we want to save and that can be helpful for many developers and make their work easier with implementing many functionalities that if Redis didn't have it, it would take such a long time to implement a high-quality system like this.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting an expiration date
&lt;/h3&gt;

&lt;p&gt;There are two ways to set an expiration date. One, setting it while storing data at Redis database, and two, setting expiration date after the record is stored in the database.&lt;/p&gt;

&lt;h4&gt;
  
  
  Setting expiration date while storing the record
&lt;/h4&gt;

&lt;p&gt;First, let's talk about the first way. This isn't much different from how we stored the records before we just need to pass two more arguments to the &lt;code&gt;SET&lt;/code&gt; command. Look at the syntax below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SET KEY VALUE EX SECONDS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the syntax shown at the top, the &lt;code&gt;KEY&lt;/code&gt; and the &lt;code&gt;VALUE&lt;/code&gt; is like before and we just need to add an &lt;code&gt;EX&lt;/code&gt; at the end of our command and then put the expiration time in seconds in place &lt;code&gt;SECONDS&lt;/code&gt;. Look at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SET user:age 17 EX 2592000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we are storing &lt;code&gt;17&lt;/code&gt; with the key of &lt;code&gt;user:age&lt;/code&gt; and setting the expiration time in 2592000 seconds from now which is the equivalent of 30 days from now. So after 39 days, this record will no longer exist on the database.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: Keep in mind you can use &lt;code&gt;PX&lt;/code&gt; instead of &lt;code&gt;EX&lt;/code&gt; in order to use milliseconds instead of seconds.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Setting expiration date after storing the record
&lt;/h4&gt;

&lt;p&gt;After we stored the data there is still a way to put the expiration date for the record. We can use the &lt;code&gt;EXPIRE&lt;/code&gt; command to take such action. Look at the syntax below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; EXPIRE KEY SECONDS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this syntax, we need to replace the &lt;code&gt;KEY&lt;/code&gt; with the key that we used to store our data, and then we can replace the &lt;code&gt;SECONDS&lt;/code&gt; with the number of seconds that we want Redis to wait before removing the record from the database. Look at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; EXPIRE user:age 2592000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you did what we did before and stored a value with the &lt;code&gt;user:age&lt;/code&gt; and expiration date of 2592000 seconds, This will just set the expiration date again. That means 30 days from when you called the command.&lt;/p&gt;

&lt;h3&gt;
  
  
  Checking remaining of expiration date
&lt;/h3&gt;

&lt;p&gt;If you need to check how much time is left for the record to expire, you can use the &lt;code&gt;TTL&lt;/code&gt; command. This command will return the number of seconds left before the record expiration. Look at the syntax below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; TTL KEY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this syntax, we just need to use the key that we use to store the record and then we can get the remaining Seconds left to expire. Look at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; TTL user:age
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, Redis will return the time left to expire for the record with the key of &lt;code&gt;user:age&lt;/code&gt;. The return line will be something like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(integer) 2591685
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that depending on when you called the first command and when you called this command, you will receive different results.&lt;/p&gt;

&lt;p&gt;One of the questions that you might have now is what happens when we call the &lt;code&gt;TTL&lt;/code&gt; command on a record that doesn't have an expiration date. Well, the answer is simple it will just return an &lt;code&gt;(integer) -1&lt;/code&gt; to indicate that this record doesn't have an expiration date. The return line will be something like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(integer) -1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Removing expiration date
&lt;/h3&gt;

&lt;p&gt;One of the other actions that you might what to take after putting an expiration date on a record, is to remove the expiration date if necessary. Well, we can do that using the &lt;code&gt;Persist&lt;/code&gt; command. This command will help us remove the expiration date. Look at the syntax below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; PERSIST KEY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All you have to do to remove a record's expiration date is to use its key instead of &lt;code&gt;KEY&lt;/code&gt; and you will have its expiration date removed. Look at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; PERSIST user:age
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example will remove the expiration date of the record with the key of &lt;code&gt;user:age&lt;/code&gt; and if we call the &lt;code&gt;TTL&lt;/code&gt; command on this record, we will receive an &lt;code&gt;(integer) -1&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: Keep in mind you can use &lt;code&gt;PEXPIRE&lt;/code&gt; and &lt;code&gt;PTTL&lt;/code&gt; commands instead of &lt;code&gt;EXPIRE&lt;/code&gt; and &lt;code&gt;TTL&lt;/code&gt; commands in order to use milliseconds instead of seconds.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Lists
&lt;/h2&gt;

&lt;p&gt;In this section, we are going to talk about one of the more advanced data structures in Redis. Everything that we have talked about until this point was just string. Even the numbers that we talked about at the end of the day are saved as strings inside the database. So we are going to learn how we can use Lists inside Redis with a couple of simple commands.&lt;/p&gt;

&lt;h3&gt;
  
  
  Storing lists and adding item to lists
&lt;/h3&gt;

&lt;p&gt;Storing a list in a Redis database is somewhat different from what you might expect. To start it doesn't happen with the &lt;code&gt;SET&lt;/code&gt; command and you need to use another set of commands to work with lists.&lt;/p&gt;

&lt;p&gt;To add an Item to the list or create a list, We use &lt;code&gt;RPUSH&lt;/code&gt; and &lt;code&gt;LPUSH&lt;/code&gt; commands. The &lt;code&gt;RPUSH&lt;/code&gt; command adds one or more items from right to our list and the &lt;code&gt;LPUSH&lt;/code&gt; command adds one or more items from left to our list. Look at the syntaxes below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; LPUSH KEY VALUE (...VALUE)
&amp;gt; RPUSH KEY VALUE (...VALUE)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As always &lt;code&gt;KEY&lt;/code&gt; is the key that we use the save the record on the database and &lt;code&gt;VALUE&lt;/code&gt; is the value that we want to add to the list. It is important to keep in mind you can add more than one value with one command and that is why we have the &lt;code&gt;(...VALUE)&lt;/code&gt; to represent unnecessary more than one value. Look at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; LPUSH user:languages "English" "Persian" "Kurdish"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we are creating a new record with the type of list and key of &lt;code&gt;user:languages&lt;/code&gt; and adding English, Persian, and Kurdish to the list. If we want to add more we can just use this command again and add more items to the list. Look at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; RPUSH user:languages "Arabic"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the example above, using the &lt;code&gt;RPUSH&lt;/code&gt; command we are pushing a new item to the right of the list with the key of &lt;code&gt;user:languages&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;These commands will return an integer in the result that indicates the length of our list. For example, this was the return line of the last command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(integer) 4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another important point to make is that when we use &lt;code&gt;RPUSH&lt;/code&gt; and &lt;code&gt;LPUSH&lt;/code&gt; commands with multiple items, it won't take the items we gave to them and put them directly inside the right or left of the list. It will go one by one over our items and take the actions on them. This means when we called &lt;code&gt;LPUSH user:languages "English" "Persian" "Kurdish"&lt;/code&gt;, first "English" was pushed to the left side then "Persian" was pushed to the left, and finally "Kurdish" was pushed to the left of our list, which makes "Kurdish" the first item of our list from left and "English" the last item of our list from left.&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting stored lists
&lt;/h3&gt;

&lt;p&gt;While working with a list we are going to deal with list indexes. The index of each list starts from left with the number of 0 and as we move on the items, the number of the index increases each item that we pass. In Redis, if we want to get items index from right we use negative integers. That means the first index from the right is -1 because we don't have negative or positive 0 and it's just 0. If you are confused, the image below might help you a lot.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq3znk71k6ngi330wl6b8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq3znk71k6ngi330wl6b8.jpg" alt="List Index System"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So with this indexing system in mind let's explain the next command that helps us get items inside a list. To get items inside a list, we can use &lt;code&gt;LRANGE&lt;/code&gt;. The &lt;code&gt;LRANGE&lt;/code&gt; command helps us get items that are between two indexes. Look at the syntax of this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; LRANGE KEY START STOP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point I expect you to know what the &lt;code&gt;KEY&lt;/code&gt; argument is. So with that in mind let's explain the two remaining arguments. First, let's talk about the &lt;code&gt;START&lt;/code&gt; argument, this argument determines the index of the first item in the list that Redis should return for us. Now let's talk about the &lt;code&gt;STOP&lt;/code&gt; argument, this argument determines the index of the last item in the list that Redis should return for us, and this command together will provide Redis with a range of items that should return in response for us. Let's take a look at this example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; LRANGE user:languages 0 -1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example will return every item in the list for us because 0 is the first index in the list and -1 is the last index in the list. The results should be something like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1) "Kurdish"
2) "Persian"
3) "English"
4) "Arabic"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Removing items from lists
&lt;/h3&gt;

&lt;p&gt;Now that we can store and receive items from our list, it's time to find out how we can remove items from our list. There are two commands to remove the items from our list, &lt;code&gt;RPOP&lt;/code&gt; and &lt;code&gt;LPOP&lt;/code&gt;. These two commands will help us pop(remove) an item from the left or right of the list. Look at the syntaxes below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; RPOP KEY
&amp;gt; LPOP KEY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;RPOP&lt;/code&gt; command will remove an item from the right of our list and the &lt;code&gt;LPOP&lt;/code&gt; command will remove an item from the left of our list. All we need to do is provide Redis with the list's key. Look at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; RPOP user:languages
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will remove an item from the end of the list and return the removed item. The return line for the example that we just showed, would be something like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"Arabic"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  List length
&lt;/h3&gt;

&lt;p&gt;One last command for working with lists that we will cover in this article is the &lt;code&gt;LLEN&lt;/code&gt; command. This command will help us get the length of our list. Look at the syntax below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; LLEN KEY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using this simple command we will get the length of the list with the provided key. Look at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; LLEN user:languages
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will return an integer number showing the length of our list. The result will be something like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(integer) 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Sets
&lt;/h2&gt;

&lt;p&gt;In this section, we are going to talk about another advanced data structure in Redis world, Set. Set is a collection just like list. Sets aren't ordered, which means there is no index when working with sets. Another important feature is the uniqueness of each item and there can't be multiple equal items in one set, unlike lists.&lt;/p&gt;

&lt;h3&gt;
  
  
  Storing sets and add members to sets
&lt;/h3&gt;

&lt;p&gt;Just like lists, there are no initial declarations for sets, and adding the first member to the set will automatically create the set. In order to add a member to a set, we use the &lt;code&gt;SADD&lt;/code&gt; command. Look at the syntax below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SADD KEY MEMBER (...MEMBER)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As we have seen in working with lists, this is a very familiar syntax. We can add one or multiple members to a set using this syntax. Look at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SADD user:skills "redis"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we are creating a new set with one member. This command will return the new length of the set. For example in this case the return line will look like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(integer) 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Removing members from sets
&lt;/h3&gt;

&lt;p&gt;Now we can move on to how we can remove members from a set. This action can be taken using the &lt;code&gt;SREM&lt;/code&gt; command. Look at the syntax below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SREM KEY MEMBER (...MEMBER)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using this syntax you can remove one or multiple members of a set associated with the provided key. Look at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SREM user:skills "redis"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we are removing &lt;code&gt;"redis"&lt;/code&gt; from the set with the key of &lt;code&gt;user:skills&lt;/code&gt;. The result of this action will be either an integer 1 or an integer 0. 1 meaning the &lt;code&gt;"redis"&lt;/code&gt; was a member of the set and 0 meaning that it wasn't a member of the set.&lt;/p&gt;

&lt;h3&gt;
  
  
  Checking if a value is member of a set
&lt;/h3&gt;

&lt;p&gt;We can also check if a value is a member of a set using the &lt;code&gt;SISMEMBER&lt;/code&gt; command. Look at the syntax below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SISMEMBER KEY MEMBER
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using this syntax we can check for the existence of one member in the set. Loot at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SISMEMBER user:skills "redis"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This action will check if &lt;code&gt;"redis"&lt;/code&gt; is a member of &lt;code&gt;user:skills&lt;/code&gt;. This will return an integer number, 1 meaning value is member of the set and 0 meaning value is not a member of the set.&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting members of a set
&lt;/h3&gt;

&lt;p&gt;Getting members of a set is the last part that we are going to cover related to sets. To get members, we use the &lt;code&gt;SMEMBERS&lt;/code&gt; command. Look at the syntax below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SMEMBERS KEY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you see all we need to provide Redis is the key associated with our record and then we can get all the members of a set. To test this, first let's add some members to our set using the command below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SADD user:skills "redis" "express" "react"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's test our new command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; SMEMBERS user:skills
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As we said before this will return all the members of this set. The return line will look something like the below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1) "react"
2) "redis"
3) "express"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Sorted sets
&lt;/h3&gt;

&lt;p&gt;This is one of the newest Redis data structures. We are going to talk a little bit about it to just introduce you to the data structure because this is a quick tutorial and it has already become a very long article. A sorted set is just like the normal set with only one difference, each member is associated with a score when you are creating it and that allows Redis to sort it. We aren't going to cover any commands but you can checkout the documents on the Redis's official website.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hashes
&lt;/h2&gt;

&lt;p&gt;The last data structure that we are going to cover is hashes. Hashes are maps with string keys and string values and they are the perfect data type to represent objects.&lt;/p&gt;

&lt;h3&gt;
  
  
  Storing fields
&lt;/h3&gt;

&lt;p&gt;Just like the lists and sets, hashes also doesn't have any form of declaration and by storing the first field you have already created the hash. To create a field, we use the &lt;code&gt;HSET&lt;/code&gt; command. Look at the syntax below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; HSET KEY FIELD VALUE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using this syntax we can create a field on a hash. Now let's try to recreate our user's model using hashes. Look at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; HSET user name "Aria"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we are creating a field named &lt;code&gt;name&lt;/code&gt; on the hash with the key of &lt;code&gt;user&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Receive data from hashes
&lt;/h3&gt;

&lt;p&gt;There are two ways to receive data from hashes. One, getting data of all of the fields at once, and two, getting data of each field alone.&lt;/p&gt;

&lt;p&gt;Let's talk about the first way. In order to get every field of a hash, we can use the &lt;code&gt;HGETALL&lt;/code&gt; command. Look at the syntax below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; HGETALL KEY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using this syntax we can get all of the hash's fields and values. It will represent the data in a special way. Let's see this in action:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; HGETALL user
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we are getting every field and value on the hash with the key of &lt;code&gt;user&lt;/code&gt;. Redis returns the data in a list. The odd indexes are fields and the even indexes are values of that fields. Take a look at the return line of this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1) "name"
2) "Aria"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In here &lt;code&gt;"name"&lt;/code&gt; is the field and &lt;code&gt;"Aria"&lt;/code&gt; is the value. If we had more fields it would continue with the same pattern.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deleting fields
&lt;/h3&gt;

&lt;p&gt;We are also able to delete each field instead of deleting the hash altogether. To delete a field we use the &lt;code&gt;HDEL&lt;/code&gt; command. Look at the syntax below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; HDEL KEY FIELD (...FIELD)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we need to provide the key of the hash and the name of the fields that we want to remove. Look at the example below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; HDEL user name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In here we are removing the field &lt;code&gt;name&lt;/code&gt; from the hash with the key of &lt;code&gt;user&lt;/code&gt;. This action as always will return an integer number to indicate if the field or fields existed on the hash or not.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Words
&lt;/h2&gt;

&lt;p&gt;There are many more commands to work with Redis especially with hashes and sorted sets and there is much more than you can explore and learn. This was just a short article to take you to a certain level to make you able to work better with Redis. Continue your journey with Redis. One of the best sources is Redis's official website that I highly recommend for you to check out and see its documents. Have a good journey.&lt;/p&gt;

&lt;h3&gt;
  
  
  Resources
&lt;/h3&gt;

&lt;p&gt;Huge thanks to the Try Redis website that has helped a lot with the order of this tutorial.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://redis.io/" rel="noopener noreferrer"&gt;Redis&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://try.redis.io/" rel="noopener noreferrer"&gt;Try Redis&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Find Me
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://twitter.com/AriaAzadiPour" rel="noopener noreferrer"&gt;&lt;code&gt;@AriaAzadiPour&lt;/code&gt;&lt;/a&gt; on Twitter&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>redis</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>database</category>
    </item>
    <item>
      <title>JavaScript use-cases and most popular technologies used with JavaScript</title>
      <dc:creator>Aria Azadi Pour</dc:creator>
      <pubDate>Thu, 11 Nov 2021 23:36:09 +0000</pubDate>
      <link>https://forem.com/devaddict/javascript-use-cases-and-most-popular-technologies-used-with-javascript-10j3</link>
      <guid>https://forem.com/devaddict/javascript-use-cases-and-most-popular-technologies-used-with-javascript-10j3</guid>
      <description>&lt;p&gt;JavaScript is one of the most loved and used languages in the development industry. JavaScript came to life at Netscape, Netscape was the creator of the Netscape navigator one of the most popular browsers of the 90s. Netscape came to the conclusion that they need to make some technology that helps developers to create a dynamic website and since they had 90% of the market share at the time, it became the industry standard.&lt;/p&gt;

&lt;p&gt;At the start, JavaScript was only used for web development but as time passed and the v8 engine came to life and the rise of Node.js, JavaScript was no longer a language that was only used for web development and became popular for many other use-cases too. &lt;/p&gt;

&lt;p&gt;In this article, I'm going to talk about some of the areas that JavaScript is used for and the most popular technologies that are used in those areas.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use Case
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Front-end Development&lt;/li&gt;
&lt;li&gt;Back-end Development&lt;/li&gt;
&lt;li&gt;CLI Development&lt;/li&gt;
&lt;li&gt;Mobile Application Development&lt;/li&gt;
&lt;li&gt;Desktop Application Development&lt;/li&gt;
&lt;li&gt;Game Development&lt;/li&gt;
&lt;li&gt;AI and Data Science&lt;/li&gt;
&lt;li&gt;IoT and Robotics&lt;/li&gt;
&lt;li&gt;Smart Watch Application Development&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Front-end Development
&lt;/h2&gt;

&lt;p&gt;JavaScript's main purpose when it was created was to give the developers more ability to create more dynamic websites. Since then JavaScript has been on a wild journey to become where it is now and at one point was even considered near extinction. JavaScript was revived in 2009 with the comeback of ECMAScript and since then the open-source community has done a lot for JavaScript and brought popularity to the JavaScript world. &lt;/p&gt;

&lt;p&gt;One of the important eras for JavaScript was the rise of JavaScript front-end frameworks by the creation of frameworks like AngularJS and Ember.js. Then the community started to pay more attention to the frameworks and a lot of new frameworks were created by big and small companies and sometimes a group of independent people. The top frameworks used these days are React from Facebook, Angular from Google, and Vue from the open-source community. A lot of new frameworks have come to life in recent years too, like Svelte and GatsbyJS.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3d7w6eebioa2uh0zg2ts.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3d7w6eebioa2uh0zg2ts.jpg" alt="Front-end Application Development JavaScript"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Back-end Development
&lt;/h2&gt;

&lt;p&gt;JavaScript is also a very popular language to create back-end applications. It first came to life when Ryan Rahl created the Node.js runtime environment. Node.js rise boosts the rise and popularity of JavaScript in every development industry. Node.js main purpose was to help developers use JavaScript not just for the front-end but for the back-end too. &lt;/p&gt;

&lt;p&gt;JavaScript is used a lot in back-end development not just by small companies and independent developers but also by big companies like Netflix, Uber, PayPal, and LinkedIn. It is important to note that open-source communities have a big role in most popular node.js frameworks and they are mostly created without any overlook from big companies. Some of the most popular node.js frameworks are Express, Koa, Fastify, and Nest.&lt;/p&gt;

&lt;p&gt;It is important to note that Ryan Dahl, later on, left the node.js project to create a better runtime environment for JavaScript and named it Deno. Some of the most popular Deno frameworks to create back-end applications are Oak, Servest, and Drash.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo43uyut4rm5mqs91bhpi.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo43uyut4rm5mqs91bhpi.jpg" alt="Back-end Application Development JavaScript"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  CLI Development
&lt;/h2&gt;

&lt;p&gt;You can use both Node.js and Deno to create CLI applications and publish them to the world. It is just like starting your applications and passing some extra arguments while starting and you can then use your applications as CLI applications. Some of the most popular CLI tools in node.js are Commander and Yargs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fij6qpsxo5n4ezagzxqq7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fij6qpsxo5n4ezagzxqq7.jpg" alt="Command Line - Star Wars Movie"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Mobile Application Development
&lt;/h2&gt;

&lt;p&gt;One of the other areas in that JavaScript is very popular is in the mobile app development sector. JavaScript has too popular mobile app development technologies, React Native and Ionic. One of the biggest companies using JavaScript to create their mobile apps is Facebook. Facebook is the creator of React Native and the technology is used in wide categories of Facebook apps.&lt;/p&gt;

&lt;p&gt;But React Native and Ionic are not the only technologies that you can use to create mobile applications using JavaScript. Another very popular technology that is wildly used around the community is progressive web applications or for short PWA. PWA is a technology introduced by Google that can help you turn your website into a mobile application in a couple of steps. All of the lite versions of your popular applications are built by PWA which is basically improving your website to be a better mobile application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdh0xwx7qf2vcz9z31bz3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdh0xwx7qf2vcz9z31bz3.jpg" alt="Mobile Application Development JavaScript"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Desktop Application Development
&lt;/h2&gt;

&lt;p&gt;You can use JavaScript to create desktop applications. One of the most popular technologies to create desktop applications is Electron. Electron uses a headless browser to create a desktop application that lets developers use HTML, CSS, and JavaScript to create the desktop application and because of this Electron is very popular among front-end developers. But there are drawbacks to this solution too which is a lower performance application that doesn't bother users too much you can be using one of the applications currently without even knowing it is created by Electron. Some of the most popular apps created using electron are Visual Studio Code, WhatsApp, InVission, Figma, and Discord.&lt;/p&gt;

&lt;p&gt;Electron is not the only technology that is used to create a desktop application using JavaScript. You can also create desktop applications using React Native and Ionic. You can use React Native to create Windows applications only, but Ionic can create applications for Linux and macOS too.&lt;/p&gt;

&lt;p&gt;Also, keep in mind that the PWA technology isn't only used for mobile applications and you can also create website applications with it and it is very popular and used by many big websites like Google Services.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe48jtnmb9w5uiwb5b53a.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe48jtnmb9w5uiwb5b53a.jpg" alt="Desktop Application Development JavaScript"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Game Development
&lt;/h2&gt;

&lt;p&gt;This is the area that I have the least experience but I have worked with some 3d engine libraries and I can give you some details. JavaScript is not just used in the game development sector but it is somewhat popular and it is becoming more popular every. Creating 2d games is very easy and JavaScript has built-in functions to help you create 2d games using just plain JavaScript.&lt;/p&gt;

&lt;p&gt;JavaScript also has many third-party engines that can help you create games. Some of the most popular libraries are Three.js and PixiJS. Today you can see the rise of 3d engines everywhere in JavaScript, not just to create more games but to create more appealing websites.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5u58ouj2ung3j199a5cs.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5u58ouj2ung3j199a5cs.jpg" alt="Game Development JavaScript"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  AI and Data Science
&lt;/h2&gt;

&lt;p&gt;JavaScript is becoming more and more popular in AI and Data Science sector because the need for a way to use data science and AI in the front-end and back-end is getting bigger and bigger. Working with charts in the front-end and creating artificial intelligence that helps work with data in the back-end is the need of many companies so this sector is really popular. Some of the best libraries in the data science sector are D3.js, Chart.js, and Plotly.js, and TensorFlow.js, Brain.js, and Ma.js are some of the most popular AI libraries in JavaScript.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ja0w9uqjkxdfelij02o.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ja0w9uqjkxdfelij02o.jpg" alt="AI and Data Science"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  IoT and Robotics
&lt;/h2&gt;

&lt;p&gt;JavaScript can also be used for Robotics and IoT. This area is really not centralized currently and there aren't any clear winners for the best libraries and frameworks to be used. But I have seen the rise of many platforms in the past years and it is becoming slightly more popular.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0bgn2u2y251l9hsw86o8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0bgn2u2y251l9hsw86o8.jpg" alt="Iot and Robotics JavaScript"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Smart Watch Application Development
&lt;/h2&gt;

&lt;p&gt;JavaScript doesn't stop at Mobile and Desktop applications you can also use JavaScript to create Smart Watch applications. Well, I would say this is the most popular one on the list but it is still possible. Bangle.js is one of the most popular platforms to create apps using JavaScript for Smart Watches but also many watches support PWA technology.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feyq5p48gw0xx8xuv6pw4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feyq5p48gw0xx8xuv6pw4.jpg" alt="Smart Watch Application Development JavaScript"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;You can use JavaScript to use in many sectors that you might be interested in like any other big language. Each language is good in something but that doesn't stop it from being able to work in other sectors too. You should choose your initial career based on your interest in the language and the sector.&lt;/p&gt;

&lt;h3&gt;
  
  
  Find Me
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://twitter.com/AriaAzadiPour" rel="noopener noreferrer"&gt;&lt;code&gt;@AriaAzadiPour&lt;/code&gt;&lt;/a&gt; on Twitter&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Use gRPC with Node.js and Typescript</title>
      <dc:creator>Aria Azadi Pour</dc:creator>
      <pubDate>Fri, 08 Oct 2021 04:29:34 +0000</pubDate>
      <link>https://forem.com/devaddict/use-grpc-with-node-js-and-typescript-3c58</link>
      <guid>https://forem.com/devaddict/use-grpc-with-node-js-and-typescript-3c58</guid>
      <description>&lt;p&gt;gRPC is a modern open-source high-performance Remote Procedure Call (RPC) framework that can run in any environment. And in this article, I am going to teach you how you can use gRPC to create high-performance RPC apps using node.js and typescript.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is gRPC?
&lt;/h2&gt;

&lt;p&gt;gRPC is a technology developed at Google in 2015. It is an RPC framework that will help you create RPC applications in many of your favorite languages. If you don't know what RPC is don't worry I'm going to explain it soon. This technology is used by google itself too. It is used quite a lot with microservice structures. according to &lt;a href="https://medium.com/@EmperorRXF/evaluating-performance-of-rest-vs-grpc-1b8bdf0b22da#:~:text=gRPC%20is%20roughly%207%20times,of%20HTTP%2F2%20by%20gRPC." rel="noopener noreferrer"&gt;Evaluating Performance of REST vs. gRPC&lt;/a&gt; from &lt;a href="https://medium.com/@EmperorRXF" rel="noopener noreferrer"&gt;Ruwan Fernando&lt;/a&gt; gRPC is roughly 7 times faster than REST when receiving data and roughly 10 times faster than REST when sending data in the case he tested.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8susytd9w6lxe9sreqvd.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8susytd9w6lxe9sreqvd.jpg" alt="gRPC logo" width="800" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is RPC?
&lt;/h2&gt;

&lt;p&gt;RPC is when a computer calls a procedure to execute in another address space. It is like calling another program to run action as it was ran on your computer and because of this, the request can be so much faster than REST.&lt;/p&gt;

&lt;p&gt;Now lets go and create a simple application for sending hello messages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup Project.
&lt;/h2&gt;

&lt;p&gt;1- Initialize your project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir grpc-starter
cd grpc-starter
npm init -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2- Initialize typescript with your favorite config:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tsc init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I use the following as my typescript configuration in the &lt;code&gt;tsconfig.json&lt;/code&gt; file. you can use whatever matches your need the best&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "lib": [
      "es6"
    ],
    "allowJs": true,
    "outDir": "build",
    "rootDir": "src",
    "strict": true,
    "noImplicitAny": true,
    "esModuleInterop": true,
    "resolveJsonModule": true
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3- create the folder structure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;/proto&lt;/code&gt;: proto buffers folder(I will explain more later)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/src&lt;/code&gt;: the source directory&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/src/server&lt;/code&gt;: server directory&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/src/client&lt;/code&gt;: client directory&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/src/proto&lt;/code&gt;: auto generated code from proto buffers
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;grpc-starter/
├── proto/
└── src/
    ├── client/
    ├── proto/
    └── server/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are two ways to work with proto buffers and code generation in gRPC; dynamic or static. In static, we will generate types and code from our proto buffers but in dynamic we will not generate any typings from proto buffers and will use the code instead. dynamic can be a pretty good option if we were using JavaScript but since we need the typings to make our work easier while using TypeScript we will use the static way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create Proto Buffers
&lt;/h2&gt;

&lt;p&gt;Proto Buffers are a way to serialize data. You may be very familiar with some other serialization languages like JSON and XML. Proto Buffers are just like them and it is developed by Google and wildly used with gRPC. In this article I'm not going to talk more about them, that's for another article. &lt;/p&gt;

&lt;p&gt;First, we need to create the language enum. Well, you need to know a bit about folder structure in proto buffers we will create the language enum in &lt;code&gt;/proto/com/language/v1/language.proto&lt;/code&gt; this is a package style folder structure that is necessary while using proto buffers with gRPC.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// /proto/com/language/v1/language.proto
syntax = "proto3";

package com.language.v1;

message Language {
  enum Code {
    CODE_UNSPECIFIED = 0;
    CODE_EN = 1;
    CODE_FA = 2;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we have to create our hello service in &lt;code&gt;/proto/services/hello/v1/hello_service.proto&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// /proto/services/hello/v1/hello_service.proto
syntax = "proto3";

import "com/language/v1/language.proto";

package services.hello.v1;

service HelloService {
  rpc Greet(GreetRequest) returns (GreetResponse) {}
}

message GreetRequest {
  string name = 1;
  com.language.v1.Language.Code language_code = 2;
}

message GreetResponse {
  string greeting = 1;
  reserved "language_code";
  reserved 2;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Buf
&lt;/h2&gt;

&lt;p&gt;We will use a tool call Buf that will make code generation way easier for us. Check out the &lt;a href="https://docs.buf.build/introduction" rel="noopener noreferrer"&gt;installation page&lt;/a&gt; to understand how you can install Buf.&lt;/p&gt;

&lt;p&gt;Now we need to generate our buf config file at &lt;code&gt;/proto/buf.yaml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# /proto/buf.yaml
version: v1beta1
build:
  roots:
    - .
lint:
  use:
    - DEFAULT
breaking:
  use:
    - WIRE_JSON
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;v1&lt;/code&gt; directory that we have in our folder structure is because of the linting setting that we are using you can default the linting setting and use a different folder structure if you wish. The linting structure has also affected some of my code that you can check in &lt;a href="https://docs.buf.build/introduction" rel="noopener noreferrer"&gt;Buf Docs&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now you can run the commands below in &lt;code&gt;/proto&lt;/code&gt; directory to check your code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ buf ls-files
com\language\v1\language.proto
services\hello\v1\hello_service.proto
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can check your code for linting errors too. And if your proto buffers don't have any problem the command will return empty:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ buf lint
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;If you have used the code provided by me and your buf version is &lt;code&gt;1.0.0-rc1&lt;/code&gt; your lint command should return no error.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Generating code
&lt;/h2&gt;

&lt;p&gt;Well for code generation you can use &lt;code&gt;protoc&lt;/code&gt; as it's the more popular tool but working with &lt;code&gt;protoc&lt;/code&gt; is exhausting so we are going to use buf.&lt;/p&gt;

&lt;p&gt;Now you need to generate the buf generation config at &lt;code&gt;/proto/buf.gen.yaml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# /proto/buf.gen.yaml
version: v1beta1
plugins:
  - name: js
    out: ../src/proto
    opt: import_style=commonjs,binary
  - name: grpc
    out: ../src/proto
    opt: grpc_js
    path: grpc_tools_node_protoc_plugin
  - name: ts
    out: ../src/proto
    opt: grpc_js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you have to install grpc-tools and grpc_tools_node_protoc_ts using &lt;code&gt;npm&lt;/code&gt; or &lt;code&gt;yarn&lt;/code&gt;. These two package will help us generate code for TypeScript using buf:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ npm i -D grpc-tools grpc_tools_node_protoc_ts
or
$ yarn add -D grpc-tools grpc_tools_node_protoc_ts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you need to run the generate command inside &lt;code&gt;/proto&lt;/code&gt; directory to generate code from proto buffers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ buf generate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Implement the server
&lt;/h2&gt;

&lt;p&gt;First thing we need to do is to add the gRPC package to create our server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ npm i @grpc/grpc-js
or
$ yarn add @grpc/grpc-js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now create the &lt;code&gt;/src/server/index.ts&lt;/code&gt; file and start the gRPC using the code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {
    Server,
    ServerCredentials,
} from '@grpc/grpc-js';
const server = new Server();

server.bindAsync('0.0.0.0:4000', ServerCredentials.createInsecure(), () =&amp;gt; {
    server.start();

    console.log('server is running on 0.0.0.0:4000');
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using this code we can create a new server and bind it to &lt;code&gt;0.0.0.0:4000&lt;/code&gt; which is like starting an express server at port &lt;code&gt;4000&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now we can take advantage of our statically generated code to create a typed Greet handler like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {
    ServerUnaryCall,
    sendUnaryData,
    Server,
    ServerCredentials,
} from '@grpc/grpc-js';

import {Language} from '../proto/com/language/v1/language_pb';
import {
    GreetRequest,
    GreetResponse,
} from '../proto/services/hello/v1/hello_service_pb';

const greet = (
    call: ServerUnaryCall&amp;lt;GreetRequest, GreetResponse&amp;gt;,
    callback: sendUnaryData&amp;lt;GreetResponse&amp;gt;
) =&amp;gt; {
    const response = new GreetResponse();

    switch (call.request.getLanguageCode()) {
        case Language.Code.CODE_FA:
            response.setGreeting(`سلام، ${call.request.getName()}`);
            break;
        case Language.Code.CODE_UNSPECIFIED:
        case Language.Code.CODE_EN:
        default:
            response.setGreeting(`Hello, ${call.request.getName()}`);
    }

    callback(null, response);
};

...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we have to add the service to server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;...

import {HelloServiceService} from '../proto/services/hello/v1/hello_service_grpc_pb';

...

server.addService(HelloServiceService, {greet});

...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At the end your server file should look like something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {
    ServerUnaryCall,
    sendUnaryData,
    Server,
    ServerCredentials,
} from '@grpc/grpc-js';

import {Language} from '../proto/com/language/v1/language_pb';
import {
    GreetRequest,
    GreetResponse,
} from '../proto/services/hello/v1/hello_service_pb';
import {HelloServiceService} from '../proto/services/hello/v1/hello_service_grpc_pb';

const greet = (
    call: ServerUnaryCall&amp;lt;GreetRequest, GreetResponse&amp;gt;,
    callback: sendUnaryData&amp;lt;GreetResponse&amp;gt;
) =&amp;gt; {
    const response = new GreetResponse();

    switch (call.request.getLanguageCode()) {
        case Language.Code.CODE_FA:
            response.setGreeting(`سلام، ${call.request.getName()}`);
            break;
        case Language.Code.CODE_UNSPECIFIED:
        case Language.Code.CODE_EN:
        default:
            response.setGreeting(`Hello, ${call.request.getName()}`);
    }

    callback(null, response);
};

const server = new Server();

server.addService(HelloServiceService, {greet});

server.bindAsync('0.0.0.0:4000', ServerCredentials.createInsecure(), () =&amp;gt; {
    server.start();

    console.log('server is running on 0.0.0.0:4000');
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can add &lt;code&gt;nodemon&lt;/code&gt; to run our server and update it on change:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ npm i nodemon
or
$ yarn add nodemon
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And run the following command to start the server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nodemon src/server/index.ts --watch /src/server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that we have our server ready let's go and create our client.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implement the client
&lt;/h2&gt;

&lt;p&gt;Create the &lt;code&gt;/src/client/index.ts&lt;/code&gt; file to start writing the client code.&lt;/p&gt;

&lt;p&gt;In the client first we need to connect to our service client using the code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {credentials} from '@grpc/grpc-js';

import {HelloServiceClient} from '../proto/services/hello/v1/hello_service_grpc_pb';

const client = new HelloServiceClient('localhost:4000', credentials.createInsecure());
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can create the request and populate it with our values like below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;...

import {Language} from '../proto/com/language/v1/language_pb';
import {GreetRequest} from '../proto/services/hello/v1/hello_service_pb';

...

const request = new GreetRequest();

request.setName('Aria');
request.setLanguageCode(Language.Code.CODE_EN);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At the end you can send the request and receive the response:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;...

client.greet(request, (error, response) =&amp;gt; {
    if (error) {
        console.error(error);

        process.exit(1);
    }

    console.info(response.getGreeting());
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your client file should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {credentials} from '@grpc/grpc-js';

import {Language} from '../proto/com/language/v1/language_pb';
import {HelloServiceClient} from '../proto/services/hello/v1/hello_service_grpc_pb';
import {GreetRequest} from '../proto/services/hello/v1/hello_service_pb';

const client = new HelloServiceClient(
    'localhost:4000',
    credentials.createInsecure()
);

const request = new GreetRequest();

request.setName('Aria');
request.setLanguageCode(Language.Code.CODE_EN);

client.greet(request, (error, response) =&amp;gt; {
    if (error) {
        console.error(error);

        process.exit(1);
    }

    console.info(response.getGreeting());
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run your client using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ nodemon src/client/index.ts --watch src/client
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Final words
&lt;/h2&gt;

&lt;p&gt;Huge shoutout to &lt;a href="https://slavovojacek.medium.com/" rel="noopener noreferrer"&gt;Slavo Vojacek&lt;/a&gt; for his article on handling the proto buffers for typescript that has helped this article a lot.&lt;/p&gt;

&lt;p&gt;You can check out the full repository at &lt;a href="https://github.com/Dev-Addict/grpc-node-ts" rel="noopener noreferrer"&gt;my GitHub repo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While gRPC is amazing and super fast but it is not the best practice to use it for freelancing projects and small projects cause it will cost you a lot of time compared to REST but if you are building a dream and you want it to be the best you can have gRPC as an option and think if it is worth the cost.&lt;/p&gt;

&lt;h3&gt;
  
  
  Resources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://grpc.io/" rel="noopener noreferrer"&gt;gRPC&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/GRPC" rel="noopener noreferrer"&gt;gRPC - Wikipedia&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://medium.com/@EmperorRXF/evaluating-performance-of-rest-vs-grpc-1b8bdf0b22da" rel="noopener noreferrer"&gt;Evaluating Performance of REST vs. gRPC | Medium&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Remote_procedure_call" rel="noopener noreferrer"&gt;Remote procedure call - Wikipedia&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://slavovojacek.medium.com/grpc-on-node-js-with-buf-and-typescript-part-1-5aad61bab03b" rel="noopener noreferrer"&gt;gRPC on Node.js with Buf and TypeScript — Part 1 | medium&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.buf.build/introduction" rel="noopener noreferrer"&gt;Introduction | Buf&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Find Me
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://twitter.com/AriaAzadiPour" rel="noopener noreferrer"&gt;&lt;code&gt;@AriaAzadiPour&lt;/code&gt;&lt;/a&gt; on Twitter&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>grpc</category>
      <category>node</category>
      <category>typescript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to install Redis on your OS of choice?</title>
      <dc:creator>Aria Azadi Pour</dc:creator>
      <pubDate>Thu, 23 Sep 2021 00:45:38 +0000</pubDate>
      <link>https://forem.com/devaddict/how-to-install-redis-on-your-os-of-choice-4gdd</link>
      <guid>https://forem.com/devaddict/how-to-install-redis-on-your-os-of-choice-4gdd</guid>
      <description>&lt;p&gt;In this article, I'm going to teach you how you can use the latest version of Redis on your OS(including Windows, Linux-based OS, MacOSX, FreeBSD-based OS) using docker and binaries. We will use three different ways to install and use Redis on your OS.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Redis?
&lt;/h2&gt;

&lt;p&gt;Redis is an open-source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker. Redis provides data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes, and streams. Redis has built-in replication, Lua scripting, LRU eviction, transactions, and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--s-6OWxsH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pd45j8b4regahvg0tsdw.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--s-6OWxsH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pd45j8b4regahvg0tsdw.jpeg" alt="reids logo" width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How to use Redis on your OS of choice?
&lt;/h2&gt;

&lt;p&gt;I will teach you three ways to install and use Redis on your OS of choice. Keep in mind not all of the methods work for every OS.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Using source code(for Unix-like OS(e.g. MacOSX, Linux-based OS, FreeBSD-based OS))&lt;/li&gt;
&lt;li&gt;Using package managers(for Unix-like OS(e.g. MacOSX, Linux-based OS, FreeBSD-based OS))&lt;/li&gt;
&lt;li&gt;Using Docker(for every OS that supports Docker)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;My preferred method is using Docker, it will work perfectly for every OS and the only thing you need is to install Docker.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I have a complete article on &lt;a href="https://dev.to/devaddict/how-to-install-redis-on-windows-533c"&gt;"How to install Redis on Windows?"&lt;/a&gt; if you are a Windows consumer that can help you more.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What is Docker?
&lt;/h2&gt;

&lt;p&gt;In 2013, Docker introduced what would become the industry standard for containers. Containers are a standardized unit of software that allows developers to isolate their app from its environment, solving the “it works on my machine” headache. For millions of developers today, Docker is the de facto standard to build and share containerized apps - from desktop, to the cloud. We are building on our unique connected experience from code to cloud for developers and developer teams.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ji7T3brX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2e0zc6p6quaghhmft1b1.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ji7T3brX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2e0zc6p6quaghhmft1b1.jpeg" alt="docker logo" width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Using source code
&lt;/h2&gt;

&lt;p&gt;You can download the source code from the &lt;a href="https://redis.io"&gt;redis.io&lt;/a&gt; website but in this article, I'm going to use &lt;code&gt;wget&lt;/code&gt; to download the source for the stable release. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This method only works for Unix-like systems that can run &lt;code&gt;tar&lt;/code&gt; and &lt;code&gt;make&lt;/code&gt; commands.&lt;/p&gt;

&lt;p&gt;If any of these links didn't work just search for Redis's official installation page.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;1.First check if you have &lt;code&gt;wget&lt;/code&gt; installed on your system:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  wget --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.If you don't have &lt;code&gt;wget&lt;/code&gt; installed on your system, install it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;CentOS/RHEL/Fedora:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo yum install wget
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Debian/Ubuntu/Mint:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo apt install wget
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ArchLinux/Manjaro:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo pacman -S wget
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;openSUSE:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ zypper install wget
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;AlpineLinux:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo apk add wget
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;MacOSX:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# install Homebrew first, then run this command
$ brew install wget
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;FreeBSD:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pkg install wget
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;3.Now you need to download the source using &lt;code&gt;wget&lt;/code&gt;. I'm going to install the stable release, but if you want any other versions you can check &lt;a href="https://redis.io/download"&gt;Redis's download page&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  $ wget http://download.redis.io/redis-stable.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4.Now you can extract the downloaded files using the &lt;code&gt;tar&lt;/code&gt; command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  $ tar xvzf redis-stable.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5.Now enter the directory that is created from extracting the downloaded file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  $ cd redis-stable
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;6.Now you need to build the code in order to use it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  $ make install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If permission was denied, you need to run it as a superuser:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  $ sudo make install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Note that you can just run &lt;code&gt;make&lt;/code&gt; and it will build the code to &lt;code&gt;src/&lt;/code&gt; directory and you can run the commands from there.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;7.Finally, you can run redis-server and redis-cli to run and use redis in your terminal.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using package managers
&lt;/h2&gt;

&lt;p&gt;In this method, we are going to use your OS package manager in order to install Redis.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This method only works for Unix-like systems with package managers.&lt;/p&gt;

&lt;p&gt;You can install Homebrew for MacOSX to use this method.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;1.First, install the Redis package via your package manager:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;CentOS/RHEL/Fedora:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo yum install redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Debian/Ubuntu/Mint:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo apt install redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ArchLinux/Manjaro:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo pacman -S redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;openSUSE: for different distributions of openSUSE, you can check the official &lt;a href="https://software.opensuse.org/download/package?package=redis&amp;amp;project=server%3Adatabase"&gt;package page&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;AlpineLinux:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo apk add redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;MacOSX:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# install Homebrew first, then run this command
$ brew install redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;FreeBSD:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pkg install redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;2.Now you have access to redis-server and redis-cli commands.&lt;/p&gt;

&lt;p&gt;3.You can also start the redis service on your OS so you don't have to run redis-server to initialize the server and you can have your service running in the background:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Linux:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ systemctl start redis
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;If permission was denied, you need to run it as a superuser:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo systemctl start redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;MacOSX:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ brew services start redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;FreeBSD:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ service redis start
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;4.Finally, you can stop redis service whenever you don't need it anymore.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Linux:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ systemctl stop redis
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;If permission was denied, you need to run it as a superuser:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo systemctl stop redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;MacOSX:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ brew services stop redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;FreeBSD:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ service redis stop
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;If you are on a Linux-based system, you can also use the snap store, but I do not recommend it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Using Docker
&lt;/h2&gt;

&lt;p&gt;In this method, you need to have Docker installed. Docker has pretty good documentation to help you.&lt;/p&gt;

&lt;p&gt;1.First, you need to create the Redis container and expose port &lt;code&gt;6379&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  $ docker container run --name container-name -p 6379:6379 -d redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;docker container run&lt;/code&gt; will make docker create and run a new container. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;--name&lt;/code&gt; flag will specify the name of the container so you can change container-name to your name of choice.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-p&lt;/code&gt; flag will tell docker to expose a port from container to computer, in this case, is the Redis default port.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-d&lt;/code&gt; flag will start the container in the detach mode so the container won't stop when we close our terminal.&lt;/p&gt;

&lt;p&gt;And finally the Redis means use the Redis image.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;2.Finally, you can run redis-cli using Docker:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  $ docker container run -it --link container-name:redis --rm redis redis-cli -h redis -p 6379
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;-it&lt;/code&gt; flag will make docker open an interactive instance of the container.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--link&lt;/code&gt; flag will link the container we previously created as Redis in this container.&lt;/p&gt;

&lt;p&gt;Note that you should change container-name with the name you chose in the first command.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--rm&lt;/code&gt; flag will make docker remove the container after we close it. (This is useful cause we will no longer need this container after we ran redis-cli command)&lt;/p&gt;

&lt;p&gt;Same as before Redis means use the Redis image.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;redis-cli -h redis -p 6379&lt;/code&gt; is the command docker will run for us.&lt;/p&gt;

&lt;p&gt;In the redis-cli command &lt;code&gt;-h&lt;/code&gt; specifies the host which we set it to redis using &lt;code&gt;--link&lt;/code&gt; flag.&lt;/p&gt;

&lt;p&gt;And finally in the redis-cli command &lt;code&gt;-p&lt;/code&gt; specifies the port which is by default &lt;code&gt;6379&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Resources
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Find Me
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://twitter.com/AriaAzadiPour"&gt;&lt;code&gt;@AriaAzadiPour&lt;/code&gt;&lt;/a&gt; on Twitter&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>redis</category>
      <category>docker</category>
      <category>windows</category>
      <category>macos</category>
    </item>
    <item>
      <title>How to install Redis on Windows?</title>
      <dc:creator>Aria Azadi Pour</dc:creator>
      <pubDate>Sun, 19 Sep 2021 17:35:23 +0000</pubDate>
      <link>https://forem.com/devaddict/how-to-install-redis-on-windows-533c</link>
      <guid>https://forem.com/devaddict/how-to-install-redis-on-windows-533c</guid>
      <description>&lt;p&gt;In this article I'm going to teach you how you can use the latest version of Redis on windows using WSL or docker. We will use three different ways to install and use Redis on Windows.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Redis?
&lt;/h2&gt;

&lt;p&gt;Redis is an open-source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker. Redis provides data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes, and streams. Redis has built-in replication, Lua scripting, LRU eviction, transactions, and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftxypno9f0wgz40oya34r.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftxypno9f0wgz40oya34r.jpeg" alt="redis logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How to use Redis on Windows?
&lt;/h2&gt;

&lt;p&gt;I will teach you three ways to install and use Redis on Windows.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Using WSL(Debian based(eg. Ubuntu)) only&lt;/li&gt;
&lt;li&gt;Using WSL and Docker together&lt;/li&gt;
&lt;li&gt;Using Docker only&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;My preferred method is using docker only it will work perfectly and the only thing you need is to install Docker.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is WSL?
&lt;/h2&gt;

&lt;p&gt;The Windows Subsystem for Linux lets developers run a GNU/Linux environment -- including most command-line tools, utilities, and applications -- directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup.&lt;/p&gt;

&lt;p&gt;You can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose your favorite GNU/Linux distributions from the Microsoft Store.&lt;/li&gt;
&lt;li&gt;Run common command-line tools such as grep, sed, awk, or other ELF-64 binaries.&lt;/li&gt;
&lt;li&gt;Run Bash shell scripts and GNU/Linux command-line applications including:

&lt;ul&gt;
&lt;li&gt;Tools: vim, emacs, tmux&lt;/li&gt;
&lt;li&gt;Languages: NodeJS, Javascript, Python, Ruby, C/C++, C# &amp;amp; F#, Rust, Go, etc.&lt;/li&gt;
&lt;li&gt;Services: SSHD, MySQL, Apache, lighttpd, MongoDB, PostgreSQL.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Install additional software using your own GNU/Linux distribution package manager.&lt;/li&gt;

&lt;li&gt;Invoke Windows applications using a Unix-like command-line shell.&lt;/li&gt;

&lt;li&gt;Invoke GNU/Linux applications on Windows.&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcp9cupafbg3u89i53nvj.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcp9cupafbg3u89i53nvj.jpeg" alt="wsl(windows + linux)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Docker?
&lt;/h2&gt;

&lt;p&gt;In 2013, Docker introduced what would become the industry standard for containers. Containers are a standardized unit of software that allows developers to isolate their app from its environment, solving the “it works on my machine” headache. For millions of developers today, Docker is the de facto standard to build and share containerized apps - from desktop, to the cloud. We are building on our unique connected experience from code to cloud for developers and developer teams.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F27ns67gkfzqiabog47ol.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F27ns67gkfzqiabog47ol.jpeg" alt="docker logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Using WSL only
&lt;/h2&gt;

&lt;p&gt;In this method, you need to install WSL and a Debian-based OS like Ubuntu on WSL and then open the terminal to start our work. After installing the OS you can follow the process below to start your own redis-server on Windows and use it with redis-cli.&lt;/p&gt;

&lt;p&gt;1.As always before installing a new tool we need to update and upgrade our system you can do it with the commands below:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

  $ sudo apt update &amp;amp;&amp;amp; apt upgrade


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;2.Then you need to install redis-server package on your subsystem:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

  $ sudo apt install redis-server


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;3.Now you need to start redis-server in order to work with Redis:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

  $ sudo service redis-server start


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;4.Finally you can run redis-cli in order to test and use Redis:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

  $ redis-cli


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;Note that you need to press &lt;code&gt;(CTRL/OPT)+C&lt;/code&gt; or use the &lt;code&gt;exit&lt;/code&gt; command in order to close the redis-cli.&lt;/p&gt;

&lt;p&gt;Redis by default uses port &lt;code&gt;6379&lt;/code&gt; if the port is not empty the service will not get started.&lt;/p&gt;

&lt;p&gt;Redis configuration file is located at &lt;code&gt;/etc/redis/redis.conf&lt;/code&gt; if you need to edit any configuration. (you need sudo access in order to read or write the file)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Using WSL and Docker together
&lt;/h2&gt;

&lt;p&gt;In this method like the previous method first, you need to install WSL but you can install your OS of choice, for example, I will use Manjaro in this tutorial. After that, you need to install Docker and enable WSL integration for your OS of choice.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;you can enable WSL integration for your OS of choice by opening Docker Desktop and going to &lt;code&gt;Settings&amp;gt;Resources&amp;gt;WSL Integration&lt;/code&gt; and from there you can switch on your OS of choice.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;1.First you need to create the Redis container and expose port &lt;code&gt;6379&lt;/code&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

  $ docker container run --name container-name -p 6379:6379 -d redis


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;docker container run&lt;/code&gt; will make docker create and run a new container. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;--name&lt;/code&gt; flag will specify the name of the container so you can change container-name to your name of choice.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-p&lt;/code&gt; flag will tell docker to expose a port from container to computer, in this case, is the Redis default port.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-d&lt;/code&gt; flag will start the container in the detach mode so the container won't stop when we close our terminal.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;2.Then you need to update and upgrade your packages before installing the redis-cli.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

  $ sudo apt update &amp;amp;&amp;amp; apt upgrade


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;3.After that you need to install redis-cli using your OS package manager, in my case &lt;code&gt;pacman&lt;/code&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

  $ sudo pacman -S redis


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;note that redis-cli will usually come with another package like redis or redis-server.&lt;/p&gt;

&lt;p&gt;note that redis package names can be different in different package managers so if you are using some other OS you can do a google search and find out the name of the package for your OS.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Using Docker only
&lt;/h2&gt;

&lt;p&gt;In this method unlike the other two, you don't have to install WSL and the only thing you have to do is install Docker.&lt;/p&gt;

&lt;p&gt;1.First you need to create the Redis container and expose port &lt;code&gt;6379&lt;/code&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

  $ docker container run --name container-name -p 6379:6379 -d redis


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;docker container run&lt;/code&gt; will make docker create and run a new container. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;--name&lt;/code&gt; flag will specify the name of the container so you can change container-name to your name of choice.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-p&lt;/code&gt; flag will tell docker to expose a port from container to computer, in this case, is the Redis default port.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-d&lt;/code&gt; flag will start the container in the detach mode so the container won't stop when we close our terminal.&lt;/p&gt;

&lt;p&gt;And finally the Redis means use the Redis image.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;2.Finally you can run redis-cli using docker:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

  $ docker container run -it --link container-name:redis --rm redis redis-cli -h redis -p 6379


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;-it&lt;/code&gt; flag will make docker open an interactive instance of the container.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--link&lt;/code&gt; flag will link the container we previously created as Redis in this container.&lt;/p&gt;

&lt;p&gt;Note that you should change container-name with the name you chose in the first command.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--rm&lt;/code&gt; flag will make docker remove the container after we close it. (This is useful cause we will no longer need this container after we ran redis-cli command)&lt;/p&gt;

&lt;p&gt;Same as before Redis means use the Redis image.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;redis-cli -h redis -p 6379&lt;/code&gt; is the command docker will run for us.&lt;/p&gt;

&lt;p&gt;In the redis-cli command &lt;code&gt;-h&lt;/code&gt; specifies the host which we set it to redis using &lt;code&gt;--link&lt;/code&gt; flag.&lt;/p&gt;

&lt;p&gt;And finally in the redis-cli command &lt;code&gt;-p&lt;/code&gt; specifies the port which is by default &lt;code&gt;6379&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Resources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://redis.io" rel="noopener noreferrer"&gt;Redis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.microsoft.com/en-us/windows/wsl/about" rel="noopener noreferrer"&gt;What is the Windows Subsystem for Linux? | Microsoft Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.docker.com/why-docker" rel="noopener noreferrer"&gt;Why Docker? | Docker&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://hub.docker.com/_/redis" rel="noopener noreferrer"&gt;Redis - Official Image | Docker Hub&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Find Me
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://twitter.com/AriaAzadiPour" rel="noopener noreferrer"&gt;&lt;code&gt;@AriaAzadiPour&lt;/code&gt;&lt;/a&gt; on Twitter&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>redis</category>
      <category>windows</category>
      <category>docker</category>
      <category>wsl</category>
    </item>
    <item>
      <title>Specialize your HTML for accessibility and better SEO</title>
      <dc:creator>Aria Azadi Pour</dc:creator>
      <pubDate>Sat, 04 Sep 2021 14:32:24 +0000</pubDate>
      <link>https://forem.com/devaddict/specialize-your-html-for-accessibility-and-better-seo-2cce</link>
      <guid>https://forem.com/devaddict/specialize-your-html-for-accessibility-and-better-seo-2cce</guid>
      <description>&lt;p&gt;In this article I'm going to write about difference between semantic-logical(also referred to as logical) and physical-visual(also referred to as physical) HTML tags. &lt;br&gt;
If you are not familiar with these terms don't worry soon you will learn what they mean and how you can use your knowledge to improve your projects.&lt;/p&gt;
&lt;h2&gt;
  
  
  What are semantic-logical and physical-visual tags?
&lt;/h2&gt;

&lt;p&gt;In HTML there are ways to style a text and there are ways to set the meaning of the text for both browsers, search engines ,and some third-party software. &lt;br&gt;
The difference between styling in HTML and setting the meaning defines semantic-logical and physical-visual tags.&lt;br&gt;
As you may have guessed by the words semantic-logical tags are used to set a meaning for text and physical-visual tags are used to style the text.&lt;br&gt;
Well you may ask what's the difference between styling a text and setting a meaning for a text. &lt;br&gt;
In a very short description setting the meaning will help search engines and software understand what's the text and how important it is and styling the text will define how software should render the text.&lt;/p&gt;

&lt;p&gt;
  &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--U69fsiIc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d19eeq3fqgv2pt0tn6h3.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--U69fsiIc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d19eeq3fqgv2pt0tn6h3.jpeg" alt="difference between b and strong tag" width="190" height="87"&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;Look at the example above.&lt;br&gt;
What you are seeing might fool you in to thinking of there is no difference in using this two tags and the answer is in the look of them in the browsers yes but the &lt;code&gt;&amp;lt;strong&amp;gt;&lt;/code&gt; tag will help search engines and third-party software like Jaws for blind people to use lower tone voice for this part.&lt;br&gt;
I hope you understand difference of styling and setting a meaning for text now.&lt;/p&gt;

&lt;h2&gt;
  
  
  SEO: Should I care?
&lt;/h2&gt;

&lt;p&gt;Well as far as I'm concerned this is not relevant any more and does not have a huge effect of indexing on any of the major search engine like Google, Bing, Yandex ,and Baidu and if you are worried about search engines like DuckDuckGo and Startpage don't worry they all use indexing data of bing and google as far as I'm concerned.&lt;/p&gt;

&lt;p&gt;Also Matt Cutts of Google have made a &lt;a href="https://www.youtube.com/watch?v=awto_wCeOJ4"&gt;video&lt;/a&gt; on Google Search Central that confirms the fact that google makes no difference between semantic-logical and physical-visual tags in indexing of websites.&lt;/p&gt;

&lt;p&gt;Does this mean you shouldn't care? well no lots of screen readers still use semantic-logical tags and do not apply the physical-visual styles to the reading process so this is a very good practice for user-experience and like lots of other outdated technologies still many people believe that it have some positive points for your SEO like server-side-rendering.&lt;/p&gt;

&lt;h2&gt;
  
  
  Some physical-visual tags
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;&amp;lt;b&amp;gt;&lt;/code&gt; tag:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;b&amp;gt;&lt;/code&gt; tag is used to style the text as bold.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;&amp;lt;big&amp;gt;&lt;/code&gt; tag:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;big&amp;gt;&lt;/code&gt; tag is used to increase the font size.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;&amp;lt;blink&amp;gt;&lt;/code&gt; tag:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;blink&amp;gt;&lt;/code&gt; tag is used to make the text blink. &lt;br&gt;
I know it's weird and probably the most of new generation of developers haven't heard anything about this tag. &lt;br&gt;
This tag isn't a HTML standard. &lt;br&gt;
It was first introduced by Netscape(very old browser but very popular at it's time) and then other browsers implemented the tag too.&lt;br&gt;
At the first it was very fun; &lt;br&gt;
It made background and foreground switch and users loved it but soon developers abused the tag too much and users become frustrated so Netscape dropped the tag at version 6 and soon other browsers stop using the tag too.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;&amp;lt;i&amp;gt;&lt;/code&gt; tag:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;i&amp;gt;&lt;/code&gt; tag is used to style text as italic. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;&amp;lt;s&amp;gt;&lt;/code&gt; tag:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;s&amp;gt;&lt;/code&gt; tag is used to put strike over text. &lt;br&gt;
It become deprecated in HTML 4.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;&amp;lt;small&amp;gt;&lt;/code&gt; tag:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;small&amp;gt;&lt;/code&gt; tag is used to decrease the font size.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;&amp;lt;strike&amp;gt;&lt;/code&gt; tag:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;strike&amp;gt;&lt;/code&gt; tag is used to put strike over text. &lt;br&gt;
It become deprecated in HTML 4.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;&amp;lt;sub&amp;gt;&lt;/code&gt; tag:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;sub&amp;gt;&lt;/code&gt; tag is used to make text subscript. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;&amp;lt;sup&amp;gt;&lt;/code&gt; tag:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;sup&amp;gt;&lt;/code&gt; tag is used to make text superscript. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;&amp;lt;tt&amp;gt;&lt;/code&gt; tag:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;tt&amp;gt;&lt;/code&gt; tag is used to show text in monospaced typeface.&lt;br&gt;
It become deprecated in HTML 5.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;&amp;lt;u&amp;gt;&lt;/code&gt; tag:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;u&amp;gt;&lt;/code&gt; tag is used to put underline under text.&lt;br&gt;
It become deprecated in HTML 4.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Some semantic-logical tags
&lt;/h2&gt;

&lt;p&gt;Well there are lot's of tags introduced in HTML 5 that are used to set meaning for text but they are not subject of this article as we are talking about old concept of semantic-logic and physical-visual tags. &lt;br&gt;
You can find new HTML 5 tags that can help you a lot with meaning in lots of articles but one article that have a good list of this new tags is &lt;a href="https://study.com/academy/lesson/html-5-document-structure-elements-examples.html"&gt;HTML 5 Document Structure: Elements &amp;amp; Examples&lt;/a&gt;.&lt;br&gt;
I hope it will help you.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;&amp;lt;em&amp;gt;&lt;/code&gt; tag:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;em&amp;gt;&lt;/code&gt; tag is used to indicate that characters should be emphasized in some form(usually displayed in italics).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;&amp;lt;strong&amp;gt;&lt;/code&gt; tag:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;strong&amp;gt;&lt;/code&gt; tag is used to emphasize characters(usually displayed in bold).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;&amp;lt;code&amp;gt;&lt;/code&gt; tag:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;code&amp;gt;&lt;/code&gt; tag is used to indicate a sample of code(usually displayed in monospaced typeface).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;&amp;lt;kbd&amp;gt;&lt;/code&gt; tag:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;kbd&amp;gt;&lt;/code&gt; tag is used to indicate text that user should enter(usually displayed in monospaced typeface).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;&amp;lt;var&amp;gt;&lt;/code&gt; tag:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;var&amp;gt;&lt;/code&gt; tag is used to indicate a variable(usually displayed in italics).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;code&gt;&amp;lt;cite&amp;gt;&lt;/code&gt; tag:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;cite&amp;gt;&lt;/code&gt; tag is used to indicate a short quote or citations(usually displayed in italics).&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Resources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/271743/whats-the-difference-between-b-and-strong-i-and-em"&gt;StackOverflow(html) - What's the difference between &lt;code&gt;&amp;lt;b&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;strong&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;i&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;em&amp;gt;&lt;/code&gt;?&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.seobility.net/en/wiki/Strong_and_Bold_Tags"&gt;Seobility Wiki - Strong and Bold Tags&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=awto_wCeOJ4"&gt;YouTube - Is there a difference between the "strong" and "b" tags in terms of SEO?&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://codeengineered.com/blog/2013/html5-semantic-diff-bold-strong/"&gt;Code Engineered - HTML5: The Semantic Difference Between Bold and Strong&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.oreilly.com/library/view/html-xhtml/0596527322/ch04s05.html"&gt;O'Reilly - 4.5. Physical Style Tags - HTML &amp;amp; XHTML: The Definitive Guide, 6th Edition [Book]&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://c/bab_teach/CCSU/HTMLLesson/physicallogical.htm"&gt;Tripod - Physical and Logical Tags&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Find Me
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://twitter.com/AriaAzadiPour"&gt;&lt;code&gt;@AriaAzadiPour&lt;/code&gt;&lt;/a&gt; on Twitter&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>html</category>
    </item>
  </channel>
</rss>
