Use monotonic clock in cache

On supported systems, CLOCK_MONOTONIC_COARSE is used; otherwise,
CLOCK_MONOTONIC is chosen.