- Why should you use Redis to optimize your NodeJS application?
- Why POST, PUT and DELETE methods should never be cached?
- How is the caching process?
- Why do we cache?
- Things to install to use Redis on NodeJS?
- What is an example of an app that uses the Redis implementation?
- Is there any alternative or better than Redis?
- Is it too hard to implement Redis in NodeJS?
- What happens when we don’t use Redis?
- Can we use Redis in any OS?
2
Answers
According to many sources,
a. client request certain data
A
with request IDreq-id-1
.b. cache will be stored in high speed memory (RAM).
c. if another client request data with ID
req-id-1
, instead of reading from slower drives, it’ll deliver from cache in RAM.d. if data
A
is updated, cache withreq-id-1
will be deleted. and repeats to step a.redis
orioredis
in npm, and a redis process running.GET
request such as news portal. If it’s well known, high probability it implements redis.According to several sources that i have been searched.
By using Redis we can use cache database that gives clients faster data retrieval.
a. The POST method itself is semantically meant to post something to a resource. POST cannot be cached because if you do something once vs twice vs three times, then you are altering the server’s resource each time. Each request matters and should be delivered to the server.
b. The PUT method itself is semantically meant to put or create a resource. It is an idempotent operation, but it won’t be used for caching because a DELETE could have occurred in the meantime.
c. The DELETE method itself is semantically meant to delete a resource. It is an idempotent operation, but it won’t be used for caching because a PUT could have occurred in the meantime.
a. client request data X with ID "id1".
b. the system will check the data X in cache database on RAM.
c. if the data X available in cache database, clients will retrieve the data from cache database in RAM.
d. if data unavailable in cache database, the system will retrieve the data from API and then deliver it to clients also save it on cache database at the same time.
To shorten the data retrieval time.
Redis in npm.
Twitter, GitHub, Weibo, Pinterest, Snapchat.
Memcached, MongoDB, RabbitMQ, Hazelcast, and Cassandra are the most popular alternatives and competitors to Redis.
The redis community is quite large, you can see lots of tutorials and manuals. You should be fine
No cache , slower speed to query data and slowing performance
Redis works in most POSIX systems like Linux, *BSD, and OS X, without external dependencies, but there is no official support for Windows builds.