Why doesn't the value of `monopoly.boardwalk` change? Because it's a **cached property**!
+Invalidating the Cache
+----------------------
+
+Results of cached functions can be invalidated by outside forces. Let's demonstrate how to force the cache to invalidate:
+
+.. code-block:: python
+
+ >>> monopoly = Monopoly()
+ >>> monopoly.boardwalk
+ 550
+ >>> monopoly.boardwalk
+ 550
+ >>> # invalidate the cache
+ >>> del m.boardwalk
+ >>> # request the boardwalk property again
+ >>> m.boardwalk
+ 600
+ >>> m.boardwalk
+ 600
+
+
+
Credits
--------
# The cached version demonstrates how nothing new is added
self.assertEqual(c.add_cached, 1)
- self.assertEqual(c.add_cached, 1)
\ No newline at end of file
+ self.assertEqual(c.add_cached, 1)
+
+ def test_reset_cached_property(self):
+
+ class Check(object):
+
+ def __init__(self):
+ self.total = 0
+
+ @cached_property
+ def add_cached(self):
+ self.total += 1
+ return self.total
+
+ c = Check()
+
+ # Run standard cache assertion
+ self.assertEqual(c.add_cached, 1)
+ self.assertEqual(c.add_cached, 1)
+
+ # Reset the cache.
+ del c.add_cached
+ self.assertEqual(c.add_cached, 2)
+ self.assertEqual(c.add_cached, 2)