Commit 791baab0 authored by Shrikrishna Singh's avatar Shrikrishna Singh

Add IGitt Cache mechanism

This adds cache mechanism of IGitt,
which will help in fetching GitHub and
GitLab data using IGitt from stored cache.

Closes #51
parent 1d889b24
Pipeline #23428235 passed with stages
in 19 minutes and 30 seconds
......@@ -9,9 +9,10 @@ COPY backend/requirements.txt /app
RUN pip install -r requirements.txt
COPY backend /app
ENV BEAR_CRON_TIME='*/200 * * * *' REPO_CRON_TIME='*/200 * * * *' CONTRIBUTORS_CRON_TIME='*/200 * * * *'
ENV BEAR_CRON_TIME='*/200 * * * *' REPO_CRON_TIME='*/200 * * * *' CONTRIBUTORS_CRON_TIME='*/200 * * * *' USE_DB_CACHE=True
RUN python3 manage.py migrate
RUN python3 manage.py createcachetable
RUN python3 manage.py crontab add
CMD gunicorn coala_web.wsgi -b 0.0.0.0:8000
......@@ -95,6 +95,24 @@ DATABASES = {
}
}
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'igitt_cache',
# The default timeout, in seconds, to use for the cache.
'TIMEOUT': 60*60*24*7*4, # 4 weeks
# The maximum number of entries allowed in the cache
# before old values are deleted.
# We are storing as max values as possible in the cache to
# enhance the performance.
'OPTIONS': {'MAX_ENTRIES': 10 ** 9} # 1 trillion entries
# For more options to CACHES see
# https://docs.djangoproject.com/en/1.11/topics/cache/#cache-arguments
}
}
# Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
......
from django.apps import AppConfig
from django.core.cache import cache as django_cache
from IGitt.Utils import Cache
class OrgConfig(AppConfig):
name = 'org'
def ready(self):
# Initialize the IGitt Cache management.
Cache.use(django_cache.get, django_cache.set)
......@@ -3,7 +3,7 @@ django-crontab~=0.7.1
djangorestframework~=3.5.3
django-cors-headers~=1.3.1
django-common-helpers~=0.9.0
IGitt~=0.2.0.dev20161119014655
IGitt~=0.4.1.dev20180607094137
gunicorn~=19.6.0
requests~=2.12.4
django-brake~=1.5.2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment