Python Cookbook : LRU cache decorator

Python Cookbook : LRU cache decorator

Looks interesting – from the description:

One-line decorator call adds caching to functions with hashable arguments and no keyword arguments. When the maximum size is reached, the least recently used entry is discarded — appropriate for long-running processes which cannot allow caches to grow without bound. Includes built-in performance instrumentation.

(Via overview by linuxer (on programming.reddit.com).)

blog comments powered by Disqus