Cached data that is not accessed during the time specified by the inactive parameter get removed from the cache Regardless of their freshness. By default,inactive are set to ten minutes.
(cached data is removed from the cache if it is not accessed within the time specified by the inactive parameter, regardless of whether it was just generated.) The default value for inactive is 10 minutes)
Sets caching time for different response codes. For example, the following directives
Proxy_cache_valid 302 10m;
proxy_cache_valid 404 1m;
Set of minutes of caching for responses with codes and 302, and 1 minute for responses with code 404.
Expires: Controls Whether the response should be marked with a expiry time, and if so, what time is.
Here is the summary:
Inactive time indicates that a file has not been accessed within a specified time and is removed from the storage system, regardless of the amount of time you set in the Proxy_cache_valid. The Proxy_cache_valid is the longest available time in terms of guaranteed access within inactive time. Proxy_cache_valid defines an absolute expiration time (the first cache time + the configured cache time), at which point the object is considered to be out of date and then goes back to end multiplicity to fetch the data, although it is accessed very frequently (that is, in the so-called inactive time). Expires, it is not in this expiration control system, it is used in the response to the client, adding "Expires" header. For specific usage of the expires Directive, refer to the official wiki.
Nginx Cache Time Description