Caching
Many times consumers request the same things, and the application returns the same information. In this scenario, caching is the solution to avoid constantly processing the same request and returning the required data faster.
Caching is used for data that does not change frequently in order to have a precalculated response without processing the request. The workflow is as follows:
- The first time that the consumer requests some information, the application processes the request and gets the required data.
- It saves the required data for that request in the cache with an expiration time that we define.
- It returns the data to the consumer.
Next time that a consumer requests something you need to do the following:
- Check whether the request is in ...
Get PHP Microservices now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.