@property
    def cached(self):
        def decorator(handler):
            def wrapper(*args, **kwargs):
                # Cache return value for given arguments
                # (except db & rate Connection objects).
                kw = dict(kwargs)
                kw.pop("db", None)
                kw.pop("rate", None)
                k = (handler, pickle.dumps(args), pickle.dumps(kw))
                if len(self._cache) >= self._cached:
                    self._cache.clear()
                if k not in self._cache:
                    self._cache[k] = handler(*args, **kwargs)
                return self._cache[k]
            return wrapper
        return decorator
The @app.cached decorator caches the return value of the given handler.
dataset/ETHPy150Open clips/pattern/pattern/server/__init__.py/Application.cached