Fetch retrieves an item from the cache. If the item exists in the cache and
is within its lifetime, it is returned. If the item does not exist, or if the
item exists but has exceeded its lifetime, the function f is invoked and the
result is updated in the cache.