I'm creating an API with "PHP" that get all responses and data from DB I'll use "VueJs" to create the Front-End as SPA and Vue-resource to make http requests, is it better to use PHP or JS to cache and what kind of data should be cached. Database will contain some texts and images only
When a particular resource is requested multiple times, it is often beneficial for developer to cache resources to give response quickly.
Caching has wide range of applications from system architectures to web software.
Cache works by temporarily storing highly requested resource in a fast access location, like RAM, which is much faster than secondary memory.
Please have a look at this page
This question has many solutions, but a popular approach is to use memcached
object storage. It stores objects in main memory.
The server side code must handle the GET
requests in layers, the request must hit the cache
layer first, check if the object is in cache
. If yes(Hit), send response, else continue serving request from next layer.