title: How to flush cached values when dictionary changes?
body: <p>I am just starting a Python package for accessing data directly from the Bureau of Economic Analysis (BEA) data API. I have two high level abstractions: <code>Request</code> and <code>Results</code>. The <code>Request</code> object inherits from <code>dict</code> and uses the requests library to access the data.</p>
  
  <pre><code>import requests
  
  
  class Request(dict):
  
      _response = None
  
      base_url = 'http://www.bea.gov/api/data'
  
      def __init__(self, UserID, Method, ResultFormat='JSON', **params):
          required_params = {'UserID': UserID,
                             'Method': Method,
                             'ResultFormat': ResultFormat}
          required_params.update(params)
          super(Request, self).__init__(**required_params)
  
      @property
      def response(self):
          if self._response is None:
              self._response = requests.get(url=self.base_url, params=self)
          return self._response
  </code></pre>
  
  <p>Because downloading the data can be time consuming I am caching the response property. My current implementation never flushes the cache. I would like to flush the cache if any values of the dictionary change or are added/removed. Thoughts?</p>