Created
March 7, 2012 21:55
-
-
Save vishvananda/1996485 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/nova/testing/fake/memcache.py b/nova/testing/fake/memcache.py | |
| index e4f238a..6677ed3 100644 | |
| --- a/nova/testing/fake/memcache.py | |
| +++ b/nova/testing/fake/memcache.py | |
| @@ -30,10 +30,11 @@ class Client(object): | |
| def get(self, key): | |
| """Retrieves the value for a key or None.""" | |
| - (timeout, value) = self.cache.get(key, (0, None)) | |
| - if timeout == 0 or utils.utcnow_ts() < timeout: | |
| - return value | |
| - return None | |
| + for key in list(self.cache.iterkeys()): | |
| + (timeout, value) = self.cache.get(key, (0, None)) | |
| + if timeout and utils.utcnow_ts >= timeout: | |
| + del self.cache[key] | |
| + return self.cache.get(key, (0, None))[1] | |
| def set(self, key, value, time=0, min_compress_len=0): | |
| """Sets the value for a key.""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment