Implement min-cache-ttl

Fixes #1342