There are all kinds of applications where caching can be useful.

For example if we need the IP address of perlmaven.com and check if the machine is alive using ping. There is no point in trying to translate the hostname to and IP address every second. After all, this mapping rarely changes. We could translate the name once, save the IP address locally and use that value in subsequent calls. That's caching.

This saves a lot of time, but we must not forget that the IP can change once in a while. So we will want to refresh the IP address stored in the cache once in a while. In other words, we will want to set an expiration date for this item in the cache.