Cache: when loading dynamic values in cache from database how to check latest data?

When loading dynamic entries in cache from database hoe to check latest data?
For example I use relational database in my back end and caching responses along the way. Suppose the result for particular request is cached but its values in database changed. How come cache knows the cached entry is outdated?