Add caching last calculated distance result.