Improve cache tests

- Tests don't die when Dalli can not connect to a server
- Stub Time.now to fix #1343 and remove the need for sleep