This is not ok. Such low-level system as cache should not through Exceptions occasionally. It would be a nightmare handling them everywhere and not handling would result in some 500 error pages to users.

To my taste infinite loop `while True: ...` is perfectly ok here because it won't be actually infinite. Version doesn't increment much in practice and also is limited by `2 ** number_of_colums_ever_used_in_filters` in theory.