Lazy loading fix

Fixes [JENKINS-18986](https://issues.jenkins-ci.org/browse/JENKINS-18986): off-by-one error on interpretation of _How far back to check_ field, relevant to newer Jenkins versions.

Patch includes update of parent version to 1.509.x line, since otherwise the `purgeCache` method used in the test is not available. If you do wish to stay behind on old versions, you could accept just the `src/main/java/` portion of the fix.