diff --git a/cached_property.py b/cached_property.py index eb9e90f..0b8df60 100644 --- a/cached_property.py +++ b/cached_property.py @@ -150,3 +150,14 @@ def __get__(self, obj, cls): # Alias to make threaded_cached_property_with_ttl easier to use threaded_cached_property_ttl = threaded_cached_property_with_ttl timed_threaded_cached_property = threaded_cached_property_with_ttl + + +def invalidate_cached_property(o, name): + """ + Invalidates the cached property so it will be re-computed again for the next access. + + :param o: The object which property should be invalidated. + :param name: The property name to be invalidated. + """ + if hasattr(o, name): + delattr(o, name)