Decorator that will postpone a functions execution until after wait seconds have elapsed since the last time it was invoked.
Full-featured O(1) LRU cache backported from Python3.3.
The full Py3.3 API is supported (thread safety, maxsize, keyword args, type checking, __wrapped__, and cache_info). Includes Py3.3 optimizations for better memory utilization, fewer dependencies, and fewer dict lookups.
Least-recently-used cache decorator.
If maxsize is set to None, the LRU features are disabled and the cache can grow without bound.
If typed is True, arguments of different types will be cached separately. For example, f(3.0) and f(3) will be treated as distinct calls with distinct results.
Arguments to the cached function must be hashable.
View the cache statistics named tuple (hits, misses, maxsize, currsize) with f.cache_info(). Clear the cache and statistics with f.cache_clear(). Access the underlying function with f.__wrapped__.
Function decorator, intended to make “func” run in a new thread (asynchronously).
>>> @run_async >>> def task1(): >>> do_something >>> >>> @run_async(daemon=True) >>> def task2(): >>> do_something_too >>> >>> t1 = task1() >>> t2 = task2() >>> ... >>> t1.join() >>> t2.join()
Decorator function. Call to a decorated function always returns the same instance
Note: it doesn’t take into account args and kwargs when looks up a saved instance Call a decorated function with spawn=True in order to get a new instance