Move requests cache into memory

We don't need to keep cache for capabilities urls in a persistance.
Memory is enought for it.

Change-Id: I1677f72f5ccb4d5bcd24c88ffe325570a57edb57
This commit is contained in:
sslypushenko 2015-05-05 15:19:11 +03:00
parent cd536e7398
commit 711f7527c4
2 changed files with 4 additions and 4 deletions

1
.gitignore vendored
View File

@ -9,4 +9,3 @@ ChangeLog
build/
cover/
dist
*.sqlite

View File

@ -48,7 +48,9 @@ CONF = cfg.CONF
CONF.register_opts(CTRLS_OPTS, group='api')
# Cached requests will expire after 10 minutes.
requests_cache.install_cache(cache_name='github_cache', expire_after=600)
requests_cache.install_cache(cache_name='github_cache',
backend='memory',
expire_after=600)
class BaseRestControllerWithValidation(rest.RestController):
@ -202,10 +204,9 @@ class CapabilitiesController(rest.RestController):
(response.status_code,
getattr(response, 'from_cache', False)))
if response.status_code == 200:
json = response.json()
regex = re.compile('^[0-9]{4}\.[0-9]{2}\.json$')
capability_files = []
for rfile in json:
for rfile in response.json():
if rfile["type"] == "file" and regex.search(rfile["name"]):
capability_files.append(rfile["name"])
return capability_files