skip to Main Content
  1. Why should you use Redis to optimize your NodeJS application?
  2. Why POST, PUT and DELETE methods should never be cached?
  3. How is the caching process?
  4. Why do we cache?
  5. Things to install to use Redis on NodeJS?
  6. What is an example of an app that uses the Redis implementation?
  7. Is there any alternative or better than Redis?
  8. Is it too hard to implement Redis in NodeJS?
  9. What happens when we don’t use Redis?
  10. Can we use Redis in any OS?

2

Answers


  1. According to many sources,

    1. It’ll gives clients faster retrieval of similar/repeated data. Therefore it’s called cached database.
    2. Because, Commands (POST,PUT,DELETE) may include many variable, thus differ to each client. Also, not worth the cache. you might want to read more about CQRS.
    3. One of the many methods, in oversimplified terms:
      a. client request certain data A with request ID req-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 with req-id-1 will be deleted. and repeats to step a.
    4. same as answer 1.
    5. redis or ioredis in npm, and a redis process running.
    6. Mostly app/site with a lot of GET request such as news portal. If it’s well known, high probability it implements redis.
    7. this is opinionated question. here’s a list of redis-like DB,
    8. as long as you read the manual/tutorial, it should be fine.
    9. no cache, thus, saving ram but slower query.
    10. works in most POSIX systems
    Login or Signup to reply.
  2. According to several sources that i have been searched.

    1. By using Redis we can use cache database that gives clients faster data retrieval.

    2. 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.

    1. We can simplify the method like this :

    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.

    1. To shorten the data retrieval time.

    2. Redis in npm.

    3. Twitter, GitHub, Weibo, Pinterest, Snapchat.

    4. Memcached, MongoDB, RabbitMQ, Hazelcast, and Cassandra are the most popular alternatives and competitors to Redis.

    5. The redis community is quite large, you can see lots of tutorials and manuals. You should be fine

    6. No cache , slower speed to query data and slowing performance

    7. Redis works in most POSIX systems like Linux, *BSD, and OS X, without external dependencies, but there is no official support for Windows builds.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search