Add caching to the changes api since it is so expensive and can return large results.

This commit is contained in:
yackob03 2013-10-20 01:18:31 -04:00
parent c90602e48d
commit 13b457c440
2 changed files with 14 additions and 0 deletions

View file

@ -20,6 +20,7 @@ from auth.permissions import (ReadRepositoryPermission,
AdministerRepositoryPermission)
from endpoints import registry
from endpoints.web import common_login
from util.cache import cache_control
store = storage.load()
@ -380,6 +381,7 @@ def get_image(namespace, repository, image_id):
@app.route('/api/repository/<path:repository>/image/<image_id>/changes',
methods=['GET'])
@cache_control(max_age=60*60) # Cache for one hour
@parse_repository_name
def get_image_changes(namespace, repository, image_id):
permission = ReadRepositoryPermission(namespace, repository)