Redis



This content originally appeared on DEV Community and was authored by Ravi Bhuvan

what is it?

  • it is a open-source in memory data store.
  • so, it like the cache stored memory, it is usually way too much faster than requesting querying the data.
  • usually when the query is made, first it finds in cache(redis memory) if not query is sent to DB, then the data is sent back to user while also saving it in the redis memory.
  • it is a structured key-value pair, but with various data structure.
redis port number : 6379

installing redis

  • redis can be a standalone application, but usually in production we use it through the docker.

Data types in redis
-Redis Strings

set name bhuv # this key-value pair
ok # output...
get name
"bhuv" # value which was saved 

in redis DB it is not recommended that name as the key, we should always the convention below

set <entity>:<id> <key> <value>
set name:1 bhuv

now these are grouped according to the name (for visualizing purpose)

for setting multiple values

mset name:1 bhu name:2 rav name:3 olaa name:3 bhoo


This content originally appeared on DEV Community and was authored by Ravi Bhuvan