Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 30
    cachetools offers an nice implementation of these and it's compatible python 2 and python 3. Commented Feb 2, 2015 at 3:18
  • 1
    big +1 for cachetools... seems pretty cool and has a couple more caching algorithms :) Commented Apr 8, 2015 at 13:15
  • This should never be suggested! Stay compatible. Commented Mar 21, 2017 at 19:41
  • 1
    @roboslone, two years (minus 4 days..) from your comment about not being thread safe, it may have changed. I have cachetools 2.0.0 and I see in the code that it uses an RLock. /usr/lib/python2.7/site-packages/cachetools/func.py Commented Jul 17, 2017 at 15:14
  • 1
    @Motty: The documentation for cachetools 4.0.0.0 says this: "Please be aware that all these classes are not thread-safe. Access to a shared cache from multiple threads must be properly synchronized, e.g. by using one of the memoizing decorators with a suitable lock object" (bold mine) Commented Mar 3, 2020 at 12:22