Isolate token caching into its own region
This will make it so that when we have to invalidate the entire token cache we don't have to invalidate *everything* in the default region. Change-Id: I4ee419c01cad610f14460752a13ade83234b1b42
This commit is contained in:
parent
d53db1889e
commit
abdc723a82
|
@ -41,6 +41,7 @@ def load_backends():
|
|||
cache.configure_cache(region=revoke.REVOKE_REGION)
|
||||
cache.apply_invalidation_patch(region=revoke.REVOKE_REGION,
|
||||
region_name=revoke.REVOKE_REGION.name)
|
||||
cache.configure_cache(region=token.provider.TOKENS_REGION)
|
||||
|
||||
# Ensure that the identity driver is created before the assignment manager
|
||||
# and that the assignment driver is created before the resource manager.
|
||||
|
|
|
@ -20,6 +20,7 @@ import datetime
|
|||
import sys
|
||||
import uuid
|
||||
|
||||
from oslo_cache import core as oslo_cache
|
||||
from oslo_log import log
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
|
@ -39,7 +40,11 @@ from keystone.token import utils
|
|||
|
||||
CONF = keystone.conf.CONF
|
||||
LOG = log.getLogger(__name__)
|
||||
MEMOIZE = cache.get_memoization_decorator(group='token')
|
||||
|
||||
TOKENS_REGION = oslo_cache.create_region()
|
||||
MEMOIZE_TOKENS = cache.get_memoization_decorator(
|
||||
group='token',
|
||||
region=TOKENS_REGION)
|
||||
|
||||
# NOTE(morganfainberg): This is for compatibility in case someone was relying
|
||||
# on the old location of the UnsupportedTokenVersionException for their code.
|
||||
|
@ -287,11 +292,11 @@ class Manager(manager.Manager):
|
|||
LOG.debug('Unable to validate token: %s', e)
|
||||
raise exception.TokenNotFound(token_id=token_id)
|
||||
|
||||
@MEMOIZE
|
||||
@MEMOIZE_TOKENS
|
||||
def validate_non_persistent_token(self, token_id):
|
||||
return self.driver.validate_non_persistent_token(token_id)
|
||||
|
||||
@MEMOIZE
|
||||
@MEMOIZE_TOKENS
|
||||
def _validate_token(self, token_id):
|
||||
if not token_id:
|
||||
raise exception.TokenNotFound(_('No token in the request'))
|
||||
|
@ -312,11 +317,11 @@ class Manager(manager.Manager):
|
|||
return self.driver.validate_v2_token(token_ref)
|
||||
raise exception.UnsupportedTokenVersionException()
|
||||
|
||||
@MEMOIZE
|
||||
@MEMOIZE_TOKENS
|
||||
def _validate_v2_token(self, token_id):
|
||||
return self.driver.validate_v2_token(token_id)
|
||||
|
||||
@MEMOIZE
|
||||
@MEMOIZE_TOKENS
|
||||
def _validate_v3_token(self, token_id):
|
||||
return self.driver.validate_v3_token(token_id)
|
||||
|
||||
|
|
Loading…
Reference in New Issue