title: How to cache value of a function in Python?
body: <p>I have a function, which given an argument calculates a corresponding value and returns it. Returned value of the function, depends only on its parameters, so I'd like to cache (memoize) the value somehow. Furthermore, I also want to be able to invalidate a cached value.</p>
  
  <p>It seems to be a common need, so I am trying to avoid reinventing the wheel.</p>
  
  <p>What I'm looking for is an advanced highly-configurable high-performance library (tool, framework, etc.) and would like the changes to be as lean as possible. Some good points are:</p>
  
  <ul>
  <li>efficiently handling concurrent requests</li>
  <li>being able to use different cache backends (e.g. RAM or DB)</li>
  <li>retaining responsiveness on large scale data</li>
  </ul>
  
  <p>What are some good libraries to use, and how are they compared?</p>