# Path: app.py



import os
import sys
from werkzeug.contrib.cache import SimpleCache
from flask import request
from app import app
    Adding caching to Flask apps
    http://flask.pocoo.org/snippets/9/
"""

sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dirname(__file__))))




CACHE_TIMEOUT = 300


cache = SimpleCache()


class cached(object):
    
    def __init__(self, timeout=None):
        self.timeout = timeout or CACHE_TIMEOUT

    def __call__(self, f):
        def decorator(*args, **kwargs):
            response = cache.get(request.path)
            if response is None:
                response = f(*args, **kwargs)
                cache.set(request.path, response, self.timeout)
            return response
        return decorator



# Path: app.py



# Path: performance/add_caching.py
import os
import sys
from werkzeug.contrib.cache import SimpleCache
from flask import request
from app import app

    Adding caching to Flask apps
    http://flask.pocoo.org/snippets/9/
"""

sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dirname(__file__))))




CACHE_TIMEOUT = 300


cache = SimpleCache()


class cached(object):
    
    def __init__(self, timeout=None):
        self.timeout = timeout or CACHE_TIMEOUT

    def __call__(self, f):
        def decorator(*args, **kwargs):
            response = cache.get(request.path)
            if response is None:
                response = f(*args, **kwargs)
                cache.set(request.path, response, self.timeout)
            return response
        return decorator



@app.route('/')