cache.add() incorrectly succeeded when there was an existing key with an infinite (None) timeout. Backport of af5f6883 from master.