Fix Redis TTL bug, add tests