Implement cache control hook

This is based on unloadProfile and will do scans of the cache directory
based on the user's cache_days setting.