© Copyright 2000-2020 Source Code Online. Free Source Code and Scripts Downloads.
Simple caching decorator
File ID: 64535
Simple caching decorator Description
Description: Memoizing decorator. Has the same API as the functools.lru_cache() in Py3.2 but without the LRU feature, so it takes less memory, runs faster, and doesn't need locks to keep the dictionary in a consistent state.
Related: Cache, memoization
|More Similar Code|
A caching decorator that garbage collects in a separate thread (for performance), allows each cached function to (optionally) set a custom maximum age for entries, and allows individual cache entries to be selectively invalidated.
A simple result-caching decorator for instance methods. NOTE: does not work with plain old non-instance-method functions. The cache is stored on the instance to prevent memory leaks caused by long-term caching beyond the life of the instance...
Synchronization has got to be one of the most popular uses for decorators, but there's no recipe here. So, this is a simple synchronization decorator.
Validation decorator based on formencode package. It uses validation schemas.
When you're new at threading, using threads can be a bit daunting at first. If all you want is just to "run this function in parallel (= asynchronously) to the main program code", then this recipe can be of use. Simply use...
The recipe presents a simple decorator for function overloading in python. The @overloaded function searches for the first overloads that doesn't raise TypeError when called. Overloads are added to the overloads list by using the...
A simple decorator that helps define abstract methods: when such a method is called, an appropriate exception is raised.
BlockTools provides a simple programatic interface for retrieving individual blocks from the block system while retaining Drupal's block caching mechanism. Additionally, BlockTools provides per block caching that can be configured through each...
This recipe provides an easy-to-use, decorator-based solution to the problem of using functions from other languages, especially C, in Python. It takes advantage of Python's new annotations to provide simple type checking and automatic conversion....
I found django's auth module is too complex for my needs, instead I wrote a relative simple one, but I miss the login_required decorator in django auth module, so I decide to write a new one.
|User Review for Simple caching decorator
All files and free downloads are copyright of their respective owners. We do not provide any hacked, cracked, illegal, pirated version of scripts, codes, components downloads. All files are downloaded from the publishers website, our file servers or download mirrors. Always Virus check files downloaded from the web specially zip, rar, exe, trial, full versions etc. Download links from rapidshare, depositfiles, megaupload etc not published.