How long is the cache appropriate?

created at 07-29-2021 views: 3

For example, memcache or redis, the data does not change during the cache, such as within 30 minutes, which is not good, but the cache time is set to be small, such as 30 seconds, how long is it good to set the cache?

Simply put, the more the capacity allows, the better, and the longer the actual data does not change, the better.

simple principles

  • It depends on your need. Some things that do not change once a day can be buffered for 1 day.
  • Different data requires different caches, generally based on the frequency of change, frequency of use, and memory usage.

summary

You can set constant data for several hours or 24 hours. The key is to see whether your data is really unchanged.

The second thing to consider is whether the hardware overhead supports storing a large amount of data in the cache for a long time.

created at:07-29-2021
edited at: 07-29-2021: