diff --git a/requirements.txt b/requirements.txt
index 5210911..4ab8053 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -12,6 +12,7 @@ nose==1.3.7
pbr==2.0.0
pycodestyle==2.3.1
pyflakes==1.5.0
+pylibmc==1.5.2
PyMySQL==0.7.11
six==1.10.0
SQLAlchemy==1.1.9
diff --git a/src/application.py b/src/application.py
index 5f11a8c..6cebd7d 100644
--- a/src/application.py
+++ b/src/application.py
@@ -23,6 +23,7 @@ except ImportError:
from src.models import db
from src.views.errors import error_pages
from src.views.scoreboard import scoreboard
+from src.resources.utilities import cache
import sys
import flask_bootstrap
import flask
@@ -33,6 +34,7 @@ def create_app(config_name):
app.config.from_object(config[config_name])
db.init_app(app)
+ cache.init_app(app)
config[config_name].init_app(app)
flask_bootstrap.Bootstrap(app)
app.register_blueprint(scoreboard)
diff --git a/src/config_lock.py b/src/config_lock.py
index cf0d32e..2759d9e 100644
--- a/src/config_lock.py
+++ b/src/config_lock.py
@@ -30,11 +30,14 @@ class Config:
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
DEBUG = True
# Server Settings
- SERVER_NAME = "localhost:5000" # If not set correctly will generate lots of 404's
- ADMIN_EMAIL = "admin@localhost.com"
- ADMIN_NAME = "WebMaster"
- APP_IP = "0.0.0.0"
+ SERVER_NAME = "localhost:5000"
+ ADMIN_EMAIL = "metonymy@fedoraproject.com"
+ ADMIN_NAME = "Metonymy"
+ APP_IP = "localhost"
APP_PORT = 5000
+ CACHE_TYPE = "memcached"
+ CACHE_DEFAULT_TIMEOUT = 60
+ CACHE_KEY_PREFIX = "benchmark_scoreboard"
# Pagination
MAX_RESULTS_PER_PAGE = 50
MAX_PAGES = 2
@@ -46,6 +49,7 @@ class Config:
class DevelopmentConfig(Config):
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'database.sqlite')
+ CACHE_TYPE = "simple"
@staticmethod
def init_app(app):
@@ -73,6 +77,7 @@ class ProductionConfig(Config):
class TestingConfig(Config):
MAX_RESULTS_PER_PAGE = 1
+ CACHE_TYPE = "simple"
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'test_database.sqlite')
@staticmethod
diff --git a/src/resources/utilities.py b/src/resources/utilities.py
index 52a3eef..8f3edd7 100644
--- a/src/resources/utilities.py
+++ b/src/resources/utilities.py
@@ -16,6 +16,10 @@
along with scoreboard-benchmark . If not, see .
"""
+from flask_cache import Cache
+
+cache = Cache()
+
def to_zero_count(page_no):
"""
diff --git a/src/views/scoreboard.py b/src/views/scoreboard.py
index a09f3a9..acdf7c0 100644
--- a/src/views/scoreboard.py
+++ b/src/views/scoreboard.py
@@ -24,6 +24,7 @@ import flask
scoreboard = flask.Blueprint('scoreboard', __name__, template_folder='templates')
+@utilities.cache.cached(timeout=60*10)
@scoreboard.route("/upload")
def upload():
"""
@@ -72,6 +73,7 @@ def result_post():
return flask.jsonify({'success': True, 'location': location}), 201, {'location': location}
+@utilities.cache.cached(timeout=60*5)
@scoreboard.route("/result/", methods=['GET'])
def result(id):
"""
@@ -85,6 +87,7 @@ def result(id):
flask.abort(404)
+@utilities.cache.cached(timeout=60)
@scoreboard.route("/", methods=['GET', 'POST'])
def index():
"""