Split solver cache in two to improve type safety