# Path: html5_appcache/settings.py
# def get_setting(key):
#     local_settings = {
#         'DISABLE': getattr(settings, "HTML5_APPCACHE_DISABLE", False),
#         'ADD_WILDCARD': getattr(settings, "HTML5_APPCACHE_ADD_WILDCARD", True),
#         'CACHE_KEY': getattr(settings, "HTML5_APPCACHE_CACHE_KEY", "html5_appcache"),
#         'CACHE_DURATION': getattr(settings, "HTML5_APPCACHE_CACHE_DURATION", 86400),
#         'USE_SITEMAP': getattr(settings, "HTML5_APPCACHE_USE_SITEMAP", True),
#         'DISCARD_EXTERNAL': getattr(settings, "HTML5_APPCACHE_DISCARD_EXTERNAL", True),
#         'SITEMAP_URL': getattr(settings, "HTML5_APPCACHE_SITEMAP_URL", "/sitemap.xml"),
#         'CACHED_URL': getattr(settings, "HTML5_APPCACHE_CACHED_URL", []),
#         'EXCLUDE_URL': getattr(settings, "HTML5_APPCACHE_EXCLUDE_URL", []),
#         'NETWORK_URL': getattr(settings, "HTML5_APPCACHE_NETWORK_URL", []),
#         'FALLBACK_URL': getattr(settings, "HTML5_APPCACHE_FALLBACK_URL", {}),
#         'OVERRIDE_URLCONF': getattr(settings, "HTML5_APPCACHE_OVERRIDE_URLCONF", False),
#         'OVERRIDDEN_URLCONF': getattr(settings, "HTML5_APPCACHE_OVERRIDDEN_URLCONF", False),
#         'DJANGOCMS_2_3': getattr(settings, "HTML5_APPCACHE_DJANGOCMS_2_3", DJANGOCMS_2_3),
#         'DJANGOCMS': getattr(settings, "HTML5_APPCACHE_DJANGOCMS", DJANGOCMS),
#     }
#     return local_settings[key]


from html5_appcache.settings import get_setting
    from django.core.cache import cache
    from django.core.cache import cache
# -*- coding: utf-8 -*-
"""
Cache maintains two version of the manifest file:
1. if ``get_cache_version() == 1`` it means the all the data are up to date
2. if ``get_cache_version() == 2`` manifest data are stale and need to be regenerated

The use of a version permit to continue serving older, but somehow still valid,
manifest data. Depending on the actual data, it may need immediate update.
"""

manifest_cache_keys = (
    "manifest", "timestamp", "data_clean"
)


def get_cache_key(key):
    return "%s:%s" % (
        get_setting('CACHE_KEY'), key)


def get_cache_version_key():

# Path: html5_appcache/settings.py
# def get_setting(key):
#     local_settings = {
#         'DISABLE': getattr(settings, "HTML5_APPCACHE_DISABLE", False),
#         'ADD_WILDCARD': getattr(settings, "HTML5_APPCACHE_ADD_WILDCARD", True),
#         'CACHE_KEY': getattr(settings, "HTML5_APPCACHE_CACHE_KEY", "html5_appcache"),
#         'CACHE_DURATION': getattr(settings, "HTML5_APPCACHE_CACHE_DURATION", 86400),
#         'USE_SITEMAP': getattr(settings, "HTML5_APPCACHE_USE_SITEMAP", True),
#         'DISCARD_EXTERNAL': getattr(settings, "HTML5_APPCACHE_DISCARD_EXTERNAL", True),
#         'SITEMAP_URL': getattr(settings, "HTML5_APPCACHE_SITEMAP_URL", "/sitemap.xml"),
#         'CACHED_URL': getattr(settings, "HTML5_APPCACHE_CACHED_URL", []),
#         'EXCLUDE_URL': getattr(settings, "HTML5_APPCACHE_EXCLUDE_URL", []),
#         'NETWORK_URL': getattr(settings, "HTML5_APPCACHE_NETWORK_URL", []),
#         'FALLBACK_URL': getattr(settings, "HTML5_APPCACHE_FALLBACK_URL", {}),
#         'OVERRIDE_URLCONF': getattr(settings, "HTML5_APPCACHE_OVERRIDE_URLCONF", False),
#         'OVERRIDDEN_URLCONF': getattr(settings, "HTML5_APPCACHE_OVERRIDDEN_URLCONF", False),
#         'DJANGOCMS_2_3': getattr(settings, "HTML5_APPCACHE_DJANGOCMS_2_3", DJANGOCMS_2_3),
#         'DJANGOCMS': getattr(settings, "HTML5_APPCACHE_DJANGOCMS", DJANGOCMS),
#     }
#     return local_settings[key]


# Path: html5_appcache/cache.py
from html5_appcache.settings import get_setting
    from django.core.cache import cache
    from django.core.cache import cache

# -*- coding: utf-8 -*-
"""
Cache maintains two version of the manifest file:
1. if ``get_cache_version() == 1`` it means the all the data are up to date
2. if ``get_cache_version() == 2`` manifest data are stale and need to be regenerated

The use of a version permit to continue serving older, but somehow still valid,
manifest data. Depending on the actual data, it may need immediate update.
"""

manifest_cache_keys = (
    "manifest", "timestamp", "data_clean"
)


def get_cache_key(key):
    return "%s:%s" % (
        get_setting('CACHE_KEY'), key)


def get_cache_version_key():

    return "%s:version" % get_setting('CACHE_KEY')