cache solve function and tests