REDIS ( REmote DIrectory Server ) – Redis Tutorial

2 weeks ago Lalit Bhagtani 0

Redis is a open source ( BSD licensed ), NoSQL database. It is an In-Memory Database, based on the concept of Key-Value Store. Redis is also referred as a Data Structure Store.

Lets understand each and every term one by one :-

  1. Key-Value Datastore :- It is a data storage paradigm, where data is stored and retrieved as a value against a key, which uniquely identifies the value stored in database. Redis can be considered as a giant Hash Table.
  2. In-Memory Database :- An In-Memory database is a database, which stores all the data in main memory ( RAM ). It means that when you query the database or when you update the data in the database, you only access the main memory. No disk access is involved. Since accessing main memory is faster than accessing disk memory, Redis database is way faster than any other disk memory based databases. Though data in the memory can be persisted on the disk using proper configuration.
  3. Data Structure Store :- In redis, key is always of a string data type but values can be of string, hash, set, sorted set, list, hyperloglog and geospatial indexes types.

Redis Tutorial

Redis is a very flexible and highly scalable datastore, which can be used as a Database, Message Broker and Cache Server. It is a single threaded, which means that it can process only one request at a time, however batch commands can be used to decrease the number of request to redis server.

In Redis, persistence of data in main memory can be achieved by two different ways. Firstly by dumping all the data to a flat file on a hard disk and secondly by storing all the executed commands to a file. When the redis server boots up, it either loads the data from dump file or execute all the commands in a sequence to make redis server in consistent and usable state.

Features :-

List of main features of redis datastore are as follows :-

  1. Atomic Operations :- All redis operations are atomic, which ensures that if two or more clients concurrently performs CRUD operations in Redis server, all the clients receives updated values.
  2. Supports multiple datatypes :- It supports multiple datatype like string, list, set, sorted set, bitmaps etc. It makes redis flexible enough to be used in multiple scenarios.
  3. Extremely Fast :- It stores all the data in main memory, which make’s it extremely fast. It also supports pipelining of commands, which enable client cli and client libraries to perform multiple operations by using multiple values in single command.
  4. Client Library Support :- It supports most of the programming languages such as C, C++, C#, Clojure, Java through client libraries. You can find complete list here.
  5. Master/Slave Replication :- Redis supports Master/Slave replication through one line configuration.

Concepts :-

List of articles covering various important concepts in redis are as follows :- 

  1. Keys Commands
  2. String Commands
  3. List Commands
  4. Set Commands
  5. Hash Commands
  6. Geo Commands
  7. Redis Keys tutorial with jedis library
  8. Redis List tutorial with jedis library
  9. Redis Set tutorial with jedis library
  10. Redis Hash tutorial with jedis library
  11. Redis Geo tutorial with jedis library
  12. Redis Pub Sub tutorial with jedis library

If you liked it, please share your thoughts in comments section and share it with others too.