@wrapt.decorator<EOL>def cached(func, instance, args, kwargs):
cache = getattr(instance, "<STR_LIT>", None)<EOL>if cache is None:<EOL><INDENT>instance.__cache = cache = {}<EOL><DEDENT>try:<EOL><INDENT>return cache[func]<EOL><DEDENT>except KeyError:<EOL><INDENT>cache[func] = result = func(*args, **kwargs)<EOL>return result<EOL><DEDENT>
Simple decorator to cache result of method calls without args.