A brief introduction about Redis

 What is Redis?

Redis stands for Remote Dictionary server and it is a fast and open source in memory, it is a key-value data store.



  • Redis is an open-source (BSD licensed), in-memory data store used as a database, cache, message, and streaming engine. Redis provides data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, and hyperlogs.
  • Redis has built-in replication, LRU eviction, transactions, and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.
  • Redis supports most leading programming languages and protocols, including Python, Java, PHP, Go, Ruby, C/C#/C++, JavaScript, Node.js, and many more. 
  • Redis is open-source software released under the terms of the three clause BSD license. Most of the Redis source code was written and is copyrighted by Salvatore Sanfilippo and Pieter Noordhuis. A list of other contributors can be found in the git history. 
Redis also includes:
  • Transactions
  • Pub/Sub
  • Lua scripting
  • Keys with a limited time-to-live
  • Automatic failover
WHAT IS REDIS CACHING?

Def of caching:
Caching is the process of storing copies of files during a cache or temporary storage location, so they’ll be accessed additional quickly. Technically, a cache is any temporary storage location for copies of files or data, however, the term Is usually employed in web technologies. Internet browsers cache hypertext markup language files, javaScript, and Pictures to load Websites more quickly, whereas DNS servers cache DNS records for quicker lookups and CDN servers cache content to scale back latency.

Redis is a great alternative for implementing an extremely offered in-memory cache to decrease information access latency, increase throughput, and ease the load off your relative or NoSQL information and application.

HOW TO INSTALL REDIS:
you can download the latest version of Redis from
https://redis.io/download
How to install Redis on Linux:
  • Open Linux Terminal
  •  Type Sudo apt-get install Redis-server
  •  Redis will automatically be up and running
How to install Redis on Windows:
NOTE: Redis is not officially supported on windows. 
Follow the below steps to create the Redis database on Microsoft Windows.
  •  Turn on Windows Subsystem for Linux
In Windows, Microsoft replaces the command prompt with Powershell as the default shell. Open Powershell as Administrator and run this command to enable Windows Subsystem for Linux (WSL). 

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

 Reboot Windows after making the charge note that you only need to do this one time.
  • Launch Microsoft Windows Store.
start ms-windows-store:

  • Install Redis
sudo apt-add-repository ppa:redislabs/redis
sudo apt-get update
sudo apt-get upgrade 
sudo apt-get install redis-server
  • Restart the Redis server
sudo service redis-server restart
  • verify if your Redis server is running
$ redis-cli 
127.0.0.1:6379> set user:1 "Jayakumar" 
127.0.0.1:6379> get user:1 "Jayakumar" 

How to install Redis on MacOS:
  • Same as Linux OS
  • Open Terminal brew install redis This command install Redis on the system.
  • To start Redis try this command: redis-server.
  • For checking Redis info use this command: brew services info redis.
  •  To stop Redis try this command: brew services stop redis.
Who uses Redis?

Companies: 6000+ companies reportedly use Redis. 
Top companies using Redis:
  • Uber 
  • Twitter 
  • GitHub 
  • Snapchat 
  • Craigslist 
  • Pinterest
Advantages of Redis:
  • It’s Exquisite fast. Faster than another cashing out there. 
  • Redis is very fast. It can perform 110,000 SET per second and 81,000 GETs per second. 
  • Due to the easy setup, Redis is simple and easy to use. 
  • Redis has bendy information structures, it helps nearly all information structures. 
  • Redis allows storing key and values pairs as large as 512 MB. 
  • Redis uses its own hashing mechanism called Redis Hashing. 
  • Zero downtime or performance impact while scaling up or down.
Disadvnatges of Redis:
  • Hard to deploy for very large operations spread throughout the cloud. 
  • No built-in encryption or RBAC is available for you to use. 
  • Very taxing on local RAM. So it means much more of the modifications need to be implemented manually. 
Redis Data Types:

It is a key-value store, but it supports many types of data structures as values other than string. The key in Redis is a binary-safe string, with a max size of 512 MB.

The data types of Redis are: 
  • String 
  • List 
  • Sets 
  • Sorted Sets 
  • Hash
Redis Commands:
Redis commands are used to perform operations. There are different commands that we can apply to our various data types. 

Some important commands are listed below: 
  •  SET command
 We can store a record in Redis using the SET command. This will set a key to hold a string value. If a key already holds a value, it will be overwritten. It has the following syntax:
SET key value 

Ex: SVA2Z
  • GET command
The GET command gives us the value of a key. IF the key doesn’t exist, it will return nil. GET only handles string values. 

The syntax is: GET key
  • LPUSH command
The LPUSH command is used to insert a value at the head of the list. We can use one or more values, and the syntax is :

LPUSH key value
  • LPOP command
The LPOP command is used to remove an element from a list at the head (or the left). LPOP: key.
  • SADD command 
This allows us to add specified members to a set stored at a key. If a key does not exist, a new set is created. SADD key value.
  • ZADD command
This command will add elements to the sorted set in the Redis database. ZADD key score value.

REDIS USAGE IN 2022:
JAYAKUMAR. P/ Associate Software Engineer

Comments

Popular posts from this blog

Oracle Database Server Architecture: Overview

Advantages and Disadvantages of React Native

Oracle E-Business Suite (EBS) - Introduction