def memcache(self, f):
        """Cache a function in memory using an internal dictionary."""
        name = _fullname(f)
        cache = self.load_memcache(name)

        @wraps(f)
        def memcached(*args):
            """Cache the function in memory."""
            # The arguments need to be hashable. Much faster than using hash().
            h = args
            out = cache.get(h, None)
            if out is None:
                out = f(*args)
                cache[h] = out
            return out
        return memcached
def memcache ( self , f ) : name = _fullname ( f ) cache = self . load_memcache ( name ) @ wraps ( f ) def memcached ( * args ) : h = args out = cache . get ( h , None ) if out is None : out = f ( * args ) cache [ h ] = out return out return memcached
Cache a function in memory using an internal dictionary.