python-cachier / cachier

Persistent, stale-free, local and cross-machine caching for Python functions.
MIT License
534 stars 60 forks source link

Cachier caches a None return value when a function raises an Exception #215

Open shaypal5 opened 4 months ago

shaypal5 commented 4 months ago

I notice this caches "None" when the function raises an Exception. Eg:

@cachier.cachier(backend='memory',allow_none=True)
def tmp_test(a):
    raise Exception()

tmp_test(123)  # Raises Exception
tmp_test(123)  # Returns None

Is this WAI?

Originally posted by @tashmore in https://github.com/python-cachier/cachier/issues/121#issuecomment-2098803095

Borda commented 3 months ago

is it only for backend='memory' or all backends?