pydanny/cached-property

Invalidating the entire cache.

carterbox opened this issue · 1 comments

I want to invalidate the entire cache with one command instead of needing to individually invalidating them. So instead of:

del monopoly.__dict__['boardwalk']
del monopoly.__dict__['parkplace']

it would be like:

del monopoly.__dict__['all']

I tried to clear the dictionary in this way:

monopoly.__dict__ = dict.fromkeys(monopoly.__dict__)

However, this also deletes the non-property variables ( e.g. monopoly.boardwalk_price) because they are all stored in the same place.

What's the best way to do this?

I think this would make for an awesome feature! However, I fear this could result in dramatic spaghettification of the code.