Merge "Sync openstack/common/memorycache.py with Oslo"

This commit is contained in:
Jenkins
2014-02-11 15:57:01 +00:00
committed by Gerrit Code Review
2 changed files with 3 additions and 4 deletions

View File

@@ -1,5 +1,3 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration. # Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved. # All Rights Reserved.
@@ -57,11 +55,11 @@ class Client(object):
def get(self, key): def get(self, key):
"""Retrieves the value for a key or None. """Retrieves the value for a key or None.
this expunges expired keys during each get This expunges expired keys during each get.
""" """
now = timeutils.utcnow_ts() now = timeutils.utcnow_ts()
for k in self.cache.keys(): for k in list(self.cache):
(timeout, _value) = self.cache[k] (timeout, _value) = self.cache[k]
if timeout and now >= timeout: if timeout and now >= timeout:
del self.cache[k] del self.cache[k]

View File

@@ -5,6 +5,7 @@ module=apiclient
module=importutils module=importutils
module=install_venv_common module=install_venv_common
module=jsonutils module=jsonutils
module=memorycache
module=strutils module=strutils
module=timeutils module=timeutils
module=py3kcompat module=py3kcompat