Caching in the application
Memory caching is another popular technique for making data available for quick retrieval. We will use memory caching to avoid roundtrips to the database servers. As the application grows, we will have to scale it out, and the calls from the web server to fetch data in the database server will get expensive. Memory caching can be used to avoid continuous roundtrips by storing data in the memory. Memory caching is commonly used to store the short-term volatile data, which helps in returning the data faster as it is stored in the memory. Memory caching should not be used as a solution to store persistent data, and it should only be used as a data store for volatile data. Let's dive into the world of memory caching using memcached.
Memcached is a fast, multithreaded, in-memory key-value store that we will use for storing serialized objects. These serialized objects will contain the output from our database calls, and they can also be used to store the output of an...