Don't set a cache entry without and entity id, plus test fix