Ticket #9761: filebased.patch
File filebased.patch, 728 bytes (added by , 16 years ago) |
---|
-
filebased.py
old new 37 37 self.set(key, value, timeout) 38 38 return True 39 39 40 def when_cached(self, key, default=0): 41 fname = self._key_to_file(key) 42 rv = default 43 try: 44 rv = os.stat(fname)[8] 45 except (IOError, OSError, EOFError, pickle.PickleError): 46 pass 47 return rv 48 49 def get_if_newer(self, key, timestamp, default=None): 50 rv = default 51 if self.when_cached(key) > timestamp: 52 rv = self.get(key) 53 return rv 54 40 55 def get(self, key, default=None): 41 56 fname = self._key_to_file(key) 42 57 try: