Cache access to cache object

This commit is contained in:
Raphael Michel
2017-10-17 18:00:07 +02:00
parent 7e1e259897
commit 03133dc1fd
12 changed files with 115 additions and 23 deletions

View File

@@ -3,6 +3,7 @@ import string
from django.core.validators import RegexValidator
from django.db import models
from django.utils.crypto import get_random_string
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from pretix.base.models.base import LoggedModel
@@ -62,6 +63,19 @@ class Organizer(LoggedModel):
Django's built-in cache backends, but puts you into an isolated environment for
this organizer, so you don't have to prefix your cache keys. In addition, the cache
is being cleared every time the organizer changes.
.. deprecated:: 1.9
Use the property ``cache`` instead.
"""
return self.cache
@cached_property
def cache(self):
"""
Returns an :py:class:`ObjectRelatedCache` object. This behaves equivalent to
Django's built-in cache backends, but puts you into an isolated environment for
this organizer, so you don't have to prefix your cache keys. In addition, the cache
is being cleared every time the organizer changes.
"""
from pretix.base.cache import ObjectRelatedCache