REDIS ( REmote DIrectory Server ) – Redis Tutorial
2 months 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 :-
- 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.
- 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.
- 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 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.
List of main features of redis datastore are as follows :-
- 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.
- 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.
- 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.
- 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.
- Master/Slave Replication :- Redis supports Master/Slave replication through one line configuration.
List of articles covering various important concepts in redis are as follows :-
- Keys Commands
- String Commands
- List Commands
- Set Commands
- Hash Commands
- Geo Commands
- Redis Keys tutorial with jedis library
- Redis List tutorial with jedis library
- Redis Set tutorial with jedis library
- Redis Hash tutorial with jedis library
- Redis Geo tutorial with jedis library
- Redis Pub Sub tutorial with jedis library
If you liked it, please share your thoughts in comments section and share it with others too.