Fixed #22495 -- Locmem cache.add() failed with infinite timeouts

cache.add() incorrectly succeeded when there was an existing key
with an infinite (None) timeout.