increment_cache_key() helper

This commit is contained in:
Laura Klünder 2018-12-21 05:48:22 +01:00
parent b4f48473d0
commit 55384274a7
2 changed files with 11 additions and 5 deletions

View file

@ -1,4 +1,13 @@
from django.core.cache import cache
from c3nav.mapdata.utils.cache.indexed import GeometryIndexed # noqa
from c3nav.mapdata.utils.cache.maphistory import MapHistory # noqa
from c3nav.mapdata.utils.cache.accessrestrictions import AccessRestrictionAffected # noqa
from c3nav.mapdata.utils.cache.package import CachePackage # noqa
def increment_cache_key(cache_key):
try:
cache.incr(cache_key)
except ValueError:
cache.set(cache_key, 0, None)