From c265ed27222fb6cd649d88c8f63c00e76b03a37b Mon Sep 17 00:00:00 2001 From: Chris Meyers Date: Wed, 20 Sep 2017 13:47:44 -0400 Subject: [PATCH] Revert "use request response cache for license checks" This reverts commit 93acae9367023fec153aa7980f2edd9f96822ba2. --- awx/conf/license.py | 3 +-- awx/main/utils/common.py | 5 ++--- awx/settings/defaults.py | 6 ------ 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/awx/conf/license.py b/awx/conf/license.py index 17a1d323c7..57456f90fa 100644 --- a/awx/conf/license.py +++ b/awx/conf/license.py @@ -8,7 +8,7 @@ from django.utils.translation import ugettext_lazy as _ from rest_framework.exceptions import APIException # Tower -from awx.main.utils.common import get_licenser, memoize +from awx.main.utils.common import get_licenser __all__ = ['LicenseForbids', 'get_license', 'get_licensed_features', 'feature_enabled', 'feature_exists'] @@ -40,7 +40,6 @@ def get_licensed_features(): return features -@memoize(cache_name='ephemeral') def feature_enabled(name): """Return True if the requested feature is enabled, False otherwise.""" validated_license_data = _get_validated_license_data() diff --git a/awx/main/utils/common.py b/awx/main/utils/common.py index e62d2274c4..c8c382472a 100644 --- a/awx/main/utils/common.py +++ b/awx/main/utils/common.py @@ -107,14 +107,13 @@ class RequireDebugTrueOrTest(logging.Filter): return settings.DEBUG or 'test' in sys.argv -def memoize(ttl=60, cache_key=None, cache_name='default'): +def memoize(ttl=60, cache_key=None): ''' Decorator to wrap a function and cache its result. ''' - from django.core.cache import caches + from django.core.cache import cache def _memoizer(f, *args, **kwargs): - cache = caches[cache_name] key = cache_key or slugify('%s %r %r' % (f.__name__, args, kwargs)) value = cache.get(key) if value is None: diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index 189ec344b3..d4747a8078 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -481,9 +481,6 @@ if is_testing(): 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', }, - 'ephemeral': { - 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', - }, } else: CACHES = { @@ -491,9 +488,6 @@ else: 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', 'LOCATION': 'memcached:11211', }, - 'ephemeral': { - 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', - }, } # Social Auth configuration.