It all depends on how often the user requests your resource and how large the resource is.
First, itβs important to understand that when you cache something, this resource will remain unchanged until the cache expires. A short-term cache will impose a longer one on the web server, but a shorter one will provide more up-to-date data if the required resource change.
Obviously, you want to cache database queries as much as possible, prioritizing those that are called frequently. But the entire cache takes up memory on the server, and as resources are exhausted, the cache will be displayed. Keep this in mind when caching large items for longer periods of time.
If you need data on how often users request a resource, you can use Google Analytics , which is very easy to set up.
For very extravagant analytics, you can use Kiwik . This requires a local server.
With very changing resources, do not cache at all, unless it is really very resource-intensive and is not vital for real-time updates.
Too many variables to give you the exact number or recommendation to make you bad.
source share