title: Caching results of a Django function call with cache.get_or_set()
body: <p>This clause works fine:</p>
  
  <pre><code>if cache.get(cache_name):
      events = cache.get(cache_name)
  else:
      events = self.get_google_events()
      cache.set(cache_name, events, 60 * 10)
  </code></pre>
  
  <p>If I put a print statement in <code>get_google_events()</code>, it's only printed if the cache is expired, as expected. But if I try to shorten the above to this:</p>
  
  <pre><code>events = cache.get_or_set(cache_name, self.get_google_events(), 60 * 10)
  </code></pre>
  
  <p>The print statement is fired every time (i.e. caching is silently broken). Isn't the second form equivalent to the first? </p>