Merge "Address nits for default cache time more explicit"

This commit is contained in:
Jenkins 2015-03-16 22:46:49 +00:00 committed by Gerrit Code Review
commit 7ca5d968c6
5 changed files with 7 additions and 7 deletions

View File

@ -915,7 +915,7 @@ class RoleManager(manager.Manager):
def create_role(self, role_id, role, initiator=None):
ret = self.driver.create_role(role_id, role)
notifications.Audit.created(self._ROLE, role_id, initiator)
if MEMOIZE.should_cache_fn(ret):
if MEMOIZE.should_cache(ret):
self.get_role.set(ret, self, role_id)
return ret

View File

@ -302,7 +302,7 @@ def get_memoization_decorator(section, expiration_section=None):
# Make sure the actual "should_cache" and "expiration_time" methods are
# available. This is potentially interesting/useful to pre-seed cache
# values.
setattr(memoize, 'should_cache_fn', should_cache)
setattr(memoize, 'expiration_time_fn', expiration_time)
setattr(memoize, 'should_cache', should_cache)
setattr(memoize, 'get_expiration_time', expiration_time)
return memoize

View File

@ -106,7 +106,7 @@ class Manager(manager.Manager):
ret = self.driver.create_project(tenant_id, tenant)
notifications.Audit.created(self._PROJECT, tenant_id, initiator)
if MEMOIZE.should_cache_fn(ret):
if MEMOIZE.should_cache(ret):
self.get_project.set(ret, self, tenant_id)
self.get_project_by_name.set(ret, self, ret['name'],
ret['domain_id'])
@ -381,7 +381,7 @@ class Manager(manager.Manager):
notifications.Audit.created(self._DOMAIN, domain_id, initiator)
if MEMOIZE.should_cache_fn(ret):
if MEMOIZE.should_cache(ret):
self.get_domain.set(ret, self, domain_id)
self.get_domain_by_name.set(ret, self, ret['name'])
return ret

View File

@ -81,7 +81,7 @@ class PersistenceManager(manager.Manager):
data_copy = copy.deepcopy(data)
data_copy['id'] = unique_id
ret = self.driver.create_token(unique_id, data_copy)
if MEMOIZE.should_cache_fn(ret):
if MEMOIZE.should_cache(ret):
# NOTE(morganfainberg): when doing a cache set, you must pass the
# same arguments through, the same as invalidate (this includes
# "self"). First argument is always the value to be cached

View File

@ -38,7 +38,7 @@ from keystone.token import persistence
CONF = cfg.CONF
LOG = log.getLogger(__name__)
MEMOIZE = cache.get_memoization_decorator('token')
MEMOIZE = cache.get_memoization_decorator(section='token')
# NOTE(morganfainberg): This is for compatibility in case someone was relying
# on the old location of the UnsupportedTokenVersionException for their code.