diff --git a/app.py b/app.py index f2bb92db2d343633c17abefc4d07f4b431b14b9d..c7de1e2a9720a703e6bb7c4251ae84e787d5a4bf 100644 --- a/app.py +++ b/app.py @@ -26,6 +26,7 @@ cache_control.init_app(app) # Flask Web Routes @app.route('/') +@cache_for(hours=1) def map(): # TODO: serve different agency depending on cookie (or special domain) agency_tag = app.config['AGENCIES'][0] @@ -35,6 +36,7 @@ def map(): return r @app.route('/e<mode>') +@cache_for(hours=1) def map_embed(mode): # TODO: serve different agency depending on cookie (or special domain) agency_tag = app.config['AGENCIES'][0] @@ -53,6 +55,7 @@ def ajax(): query = request.args.get('query') agency_tag = app.config['AGENCIES'][0] agency = db.session.query(Agency).filter(Agency.tag==agency_tag).one() + @cache_for(hours=1) def modal(name): """ Serve contents of a modal popup """ if not name.isalnum(): diff --git a/templates/modal-embed.html b/templates/modal-embed.html index d588e59e3ac729110654bf819959eafbb8937e35..b6641f20a4f3c072a6a59531f6d7b5bd1d4696f4 100644 --- a/templates/modal-embed.html +++ b/templates/modal-embed.html @@ -70,6 +70,7 @@ No guarantees are made about availability, performance, or suitability of this service for any purpose. </p> <script> + $.ajaxSetup({ cache: true }); $.getScript('static/js/embed.js', function() { BusMap.Embed({ baseUrl: "{{ url_for('map_embed', mode='', _external=True, _scheme='') }}",