#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""Data-base and caching configuration settings."""


# Database backend settings
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': working_path('dbs/pootle.db'),
        'USER': '',
        'PASSWORD': '',
        'HOST': '',
        'PORT': '',
    }
}


# Cache Backend settings
#
# By default we use Django's database cache which is only suitable
# for small deployments.
# If you are going to deploy a real server memcached is preferred. For more
# information, check
# http://docs.djangoproject.com/en/dev/topics/cache/#setting-up-the-cache
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
        'LOCATION': 'pootlecache',
        'TIMEOUT': 60,
        'OPTIONS': {
            'MAX_ENTRIES': 65536,
            'CULL_FREQUENCY': 16,
        }
    }
}

# Using memcached to store sessions improves performance for anonymous
# users. For more info, check
# http://docs.djangoproject.com/en/dev/topics/http/sessions/#configuring-the-session-engine
# Uncomment this if you're using memcached as CACHE_BACKEND
SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'

# To improve performance, non-logged users get cached copies of most pages.
# This variable is the number of seconds for which a page will be reused from
# cache. If you have a small server where more real-time statistics is
# important, you can make this lower.
CACHE_MIDDLEWARE_SECONDS = 600
CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True

# Keep stats cache for roughly a month
OBJECT_CACHE_TIMEOUT = 2500000
