PersistentStorage#get expires stale data

The ttl wasn't being used correctly in #get, the behavior should be to remove keys where the ttl is stale. Added test coverage for isExpired and a case in #clean with a ttl value, previously the test would fail if a ttl value was used because #clean only reduced index by -1 but two indexes could be removed. The new implementation delays the removal outside the loop which I think is cleaner and avoids index change conditions.