DEV Community

Ravi Bhuvan
Ravi Bhuvan

Posted on • Edited on

Redis

what is it?

  • is a REmote DIctionary Server.
  • 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
Enter fullscreen mode Exit fullscreen mode

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 
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
vpospichal profile image
Vlastimil Pospíchal

Very weak article. Redis can do much more than just key-value. You can find all the usual collections, TTL and many other useful structures.

Collapse
 
algon31 profile image
Ravi Bhuvan

yeahh, i just posted it by mistake, i am still wrting this article