Move caching responsibilities to a separate module.

This allows to easily extend cache with more sophisticated
update strategies.

User simpler query to detect if cache needs to be updated.